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 ?
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