0

All my seeders files are in database/seeds/:

$ ls -1 database/seeds/
BarSeeder.php
DatabaseSeeder.php
FooSeeder.php
UserSeeder.php

Even if I comment FooSeeder in the call function of database/seeds/DatabaseSeeder.php, it's still passed.

database/seeds/DatabaseSeeder.php:

<?php

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     *
     * @return void
     */
    public function run()
    {
        $this->call([
            UserSeeder::class,
            // FooSeeder::class,
            BarSeeder::class
        ]);
    }
}

So, what is the interest of using the call function ? Or did I miss something in my configuration ?

DevonDahon
  • 7,460
  • 6
  • 69
  • 114
  • It should only run the seeders provided to the `call` method, could you add the output of `php artisan db:seed` to your question. – Remul May 07 '20 at 15:34

1 Answers1

1

Once you have written your seeder, you may need to regenerate Composer's autoloader using the dump-autoload command:

composer dump-autoload

before running your seeder command.

check this https://laravel.com/docs/7.x/seeding

Doro
  • 347
  • 2
  • 6