项目数据库表设计与创建模型

数据库表设计

artist_info
字段名称 描述 类型 加索引缘由
id 自增长ID unsigned int 主键
gravatar 头像 varchar
name 姓名 varchar
introduce 个人介绍 varchar
work_info
字段名称 描述 类型 加索引缘由
id 自增长id unsigned int 主键
work_image 作品图片 varchar
work_name 作品名称 varchar
type 作品类型 varchar
work_introduce 作品介绍 varchar
createtime 创作时间 date

创建模型

$ php artisan make:model Models/artist_info -mf
$ php artisan make:model Models/work_info -mf

修改数据库迁移文件
database/migrations/< your_date >_create_artist_info_table.php

public function up() 
{
    Schema::create('artist_info',function (Blueprint $table) {
        $table->increments('id');
        $table->string('gavatar');
        $table->string('name');
        $table->string('introduce');
    }
}

database/migrations/< your_date >_create_work_info_table.php

public function up()
{
    Schema::create('work_info',function(Blueprint $table){
        $table->increments('id');
        $table->string('work_image');
        $table->string('work_name');
        $table->string('type');
        $table->string('work_introduce');
        $table->date('createtime');
        }
}
本作品采用《CC 协议》,转载必须注明作者和本文链接
《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!