Laravel - Seeding - Calling Additional Seeders
Within the DatabaseSeeder
class, you may use the call
method to execute additional seed classes. Using the call
method allows you to break up your database seeding into multiple files so that no single seeder class becomes too large. The call
method accepts an array of seeder classes that should be executed:
/**
* Run the database seeders.
*
* @return void
*/
public function run()
{
$this->call([
UserSeeder::class,
PostSeeder::class,
CommentSeeder::class,
]);
}