27 lines
684 B
PHP
27 lines
684 B
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use Illuminate\Database\Seeder;
|
|
use App\Models\LessonSection;
|
|
use App\Models\Module;
|
|
|
|
class LessonSectionSeeder extends Seeder
|
|
{
|
|
public function run(): void
|
|
{
|
|
$pure = Module::where('name', 'Pure Mathematics')->first();
|
|
|
|
$sections = [
|
|
['module_id' => $pure->id, 'title' => 'Year 1', 'order' => 1],
|
|
['module_id' => $pure->id, 'title' => 'Year 2', 'order' => 2],
|
|
];
|
|
|
|
foreach ($sections as $section) {
|
|
LessonSection::updateOrCreate(
|
|
['module_id' => $section['module_id'], 'title' => $section['title']],
|
|
$section
|
|
);
|
|
}
|
|
}
|
|
} |