This repository has been archived on 2026-09-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
tutoring/database/seeders/LessonSectionSeeder.php
T
2026-01-14 00:54:08 +00:00

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
);
}
}
}