0

Running php artisan db:seed does not work for some reason on my Laravel 5.6 project.

  • The command runs (quietly) even without a database
  • Does not return any error on the terminal

However, when I run php artisan db:seed --class=ClassNameTableSeeder it works. What could be the cause of such a weird behavior?

NB : Similar to questions like 39521913 but not a duplicate.

Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291
Fenn-CS
  • 863
  • 1
  • 13
  • 30

1 Answers1

2

This is because by default DatabaseSeeder does nothing. Original code in fresh Laravel project looks like this:

public function run()
{
    // $this->call(UsersTableSeeder::class);
}

So to run any database seeder, you should uncomment this line and put valid class name, so for example:

$this->call(ClassNameTableSeeder1::class);
$this->call(ClassNameTableSeeder2::class);

and so on to run seeders for each class you put here.

Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291