26 lines
563 B
PHP
26 lines
563 B
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\EggCollection;
|
|
use App\Models\EggCollectionItem;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class EggCollectionSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*/
|
|
public function run(): void
|
|
{
|
|
EggCollection::factory()
|
|
->count(30)
|
|
->create()
|
|
->each(function ($collection) {
|
|
EggCollectionItem::factory()->count(rand(1, 3))->create([
|
|
'egg_collection_id' => $collection->id,
|
|
]);
|
|
});
|
|
}
|
|
}
|