<?php

namespace Database\Seeders;

use App\Models\Guru;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class GuruSeeder extends Seeder
{
    public function run(): void
    {
        // Bersihkan data lama agar ID mulai dari GR01 lagi
        DB::statement('SET FOREIGN_KEY_CHECKS=0;');
        Guru::truncate();
        DB::statement('SET FOREIGN_KEY_CHECKS=1;');

        $gurus = [
            ['nama_guru' => 'Budi Santoso, S.Pd'],
            ['nama_guru' => 'Siti Aminah, M.Pd'],
            ['nama_guru' => 'Hendra Wijaya, S.Kom'],
            ['nama_guru' => 'Rina Kartika, M.Si'],
        ];

        foreach ($gurus as $g) {
            // Menggunakan Guru::create agar fungsi boot() di model terpanggil otomatis
            Guru::create($g);
        }
    }
}