<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\Course;
use App\Models\Level;
use App\Models\Subject;

class CourseSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $alevel   = Level::where('name', 'A Level')->first();
        $aslevel  = Level::where('name', 'AS Level')->first();
        $maths    = Subject::where('name', 'Mathematics')->first();
        $physics  = Subject::where('name', 'Physics')->first();

        $courses = [
            [
                'subject_id' => $maths->id,
                'level_id'   => $alevel->id,
				'lead_teacher' => "Richard",
				
            ],
            [
                'subject_id' => $physics->id,
                'level_id'   => $aslevel->id,
				'lead_teacher' => "Richard",
            ],
        ];

        foreach ($courses as $course) {
            Course::firstOrCreate($course);
        }
    }
}
