我是 Laravel 的新人。我想在我的数据库里加入种子。当我运行種命令时,我得到一个异常
[Illuminate\Database\Eloquent\MassAssignmentException]
username
db:seed [--class[="..."]] [--database[="..."]]
我做错了什么。我使用的命令是:
php artisan db:seed --class="UsersTableSeeder"
My seed class is as follows:
class UsersTableSeeder extends Seeder {
public function run()
{
User::truncate();
User::create([
'username' => 'PaulSheer',
'email' => 'psheer@rute.co.za',
'password' => '45678'
]);
User::create([
'username' => 'Stevo',
'email' => 'steve@rute.co.za',
'password' => '45678'
]);
}
}