22 lines
398 B
PHP
22 lines
398 B
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\Content;
|
|
use App\Models\Page;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class ContentSeeder extends Seeder
|
|
{
|
|
public function run(): void
|
|
{
|
|
$pages = Page::all();
|
|
|
|
foreach ($pages as $page) {
|
|
Content::factory()->count(rand(3, 8))->create([
|
|
'page_id' => $page->id,
|
|
]);
|
|
}
|
|
}
|
|
}
|