I have created two seeder classes 'UsersTableSeeder" and "Conferences TableSeeder". When the command "php artisan db:seed
" is executed it appears:
Seeding: UsersTableSeeder
But the ConferenceTableSeeder don't work. Do you know why can be?
UsersTableSeeder:
class UsersTableSeeder extends Seeder
{
public function run()
{
App\User::create([
'name' => 'John',
'email' => '',
'password' => bcrypt('password')
]);
}
}
ConferencesTableSeeder
class ConferencesTableSeeder extends Seeder
{
public function run()
{
App\Event::create([
'name' => 'Test name',
'description' => '',
'date' => '2018-03-08 06:30:00',
...
]);
}
}
You need to add the ConferenceTableSeeder::class
to the database\seeds\DatabaseSeeder.php
file
public function run()
{
$this->call(UsersTableSeeder::class);
$this->call(ConferenceTableSeeder::class);
}
When you run php artisan db:seed
it calls the run
method in DatabaseSeeder
class, which in turn calls the seeder files in there
The UsersTableSeeder
is in there by default, that is why only that one ran