编程语言
首页 > 编程语言> > php – Laravel 5.4种子不播种所有桌子

php – Laravel 5.4种子不播种所有桌子

作者:互联网

我在Laravel 5.4播种,但它只播种一张桌子,其他的不播种.
播种机是使用以下命令创建的:

php artisan make:seeder seederName

解决方法:

您应该在DatabaseSeeder.php中注册所有播种机:

$this->call(UsersTableSeeder::class);
$this->call(PostsTableSeeder::class);
$this->call(CommentsTableSeeder::class);

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 overwhelmingly large.

https://laravel.com/docs/5.4/seeding#calling-additional-seeders

标签:php,laravel,laravel-seeding
来源: https://codeday.me/bug/20190622/1265428.html