I am a Laravel newbie. I want to seed my database. When I run the seed command I get an exception
[IlluminateDatabaseEloquentMassAssignmentException]
username
db:seed [--class[="..."]] [--database[="..."]]
What am I doing wrong. The command I use is:
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' => '[email protected]',
'password' => '45678'
]);
User::create([
'username' => 'Stevo',
'email' => '[email protected]',
'password' => '45678'
]);
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…