首先安裝doctrine/dbal
composer require doctrine/dbal
暫時不需要name(姓名)這個單一的字段,是以把他作為username 來處理,但是為了使用時更易了解,将會把資料庫中的name字段更改為username字段,是以需要安裝上面那個依賴包。
首先建立遷移檔案
php artisan make:migration change_user_to_username_of_users_table --table=users
public functionup() { Schema::table('users',function(Blueprint$table) { $table->renameColumn('name','username'); }); }
然後php artisan migrate。
就好了。
别忘了到User的Model中更改fillable屬性。
。