1.創建migration文件,比如這裡是為user表增加字段api_token php artisan make:migration add_api_token_to_users --table=users 2.增加字段,記得要在down中dropColumn public function up() { Schema::table('users', function (Blue
php artisan make:migration add_api_token_to_users --table=users2.增加字段,記得要在down中dropColumn
public function up() { Schema::table('users', function (Blueprint $table) { $table->string('api_token',64)->unique(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('users', function (Blueprint $table) { $table->dropColumn(['api_token']); }); }3.執行生成
php artisan migration