接上篇博客
git地址
GitHub - zedisdog/laravel-schema-extend: supplement for eloquent migration
安装
composer require zedisdog/laravel-schema-extend
申明依赖 (修改config->app.php->aliases)
'aliases' => [
...
// 'Schema' => Illuminate\Support\Facades\Schema::class,
'Schema' => Jialeo\LaravelSchemaExtend\Schema::class,
],
.使用(默认创建的migration文件对应的“Schema”还是引用的laravel自带的,需要修改为该组件包的引用)
//use Illuminate\\Support\\Facades\\Schema;
use Jialeo\\LaravelSchemaExtend\\Schema;
Schema::create('auth_admins', function (Blueprint $table) {
$table->comment = '管理员表';
$table->increments('id')->comment('管理员ID');
$table->string('name',100)->default('')->comment('名称');
$table->string('phone',100)->default('')->comment('手机号');
$table->string('username',50)->unique()->default('')->comment('账号');
$table->string('password')->default('')->comment('密码');
$table->integer('group_id')->nullable()->comment('权限组ID');
$table->integer('project_id')->nullable()->comment('项目ID');
$table->tinyInteger('status')->default(1)->comment('状态:0=禁用,1=启用');
$table->timestamp('created_at')->nullable()->comment('创建时间');
$table->timestamp('updated_at')->nullable()->comment('更新时间');
});