<?php

namespace Database\Seeders;

use App\Models\LmsClasses;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class LMSClassesSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        // if (\App::environment('local')) {
        //     LmsClasses::truncate();
        // }


        $Classes = [
            [
                'class_name'      => 'Class-I',
                'class_code'      => 'CLASS_I',
                'priority'        => '1',
                'status'          => '1',
            ],
            [
                'class_name'      => 'Class-II',
                'class_code'      => 'CLASS_II',
                'priority'        => '2',
                'status'          => '1',
            ],
            [
                'class_name'      => 'Class-III',
                'class_code'      => 'CLASS_III',
                'priority'        => '3',
                'status'          => '1',
            ],
            [
                'class_name'      => 'Class-IV',
                'class_code'      => 'CLASS_IV',
                'priority'        => '4',
                'status'          => '1',
            ],
            [
                'class_name'      => 'Class-V',
                'class_code'      => 'CLASS_V',
                'priority'        => '5',
                'status'          => '1',
            ],
            [
                'class_name'      => 'Class-VI',
                'class_code'      => 'CLASS_VI',
                'priority'        => '6',
                'status'          => '1',
            ],
            [
                'class_name'      => 'Class-VII',
                'class_code'      => 'CLASS_VII',
                'priority'        => '7',
                'status'          => '1',
            ],
            [
                'class_name'      => 'Class-VIII',
                'class_code'      => 'CLASS_VIII',
                'priority'        => '8',
                'status'          => '1',
            ],
            [
                'class_name'      => 'Class-IX',
                'class_code'      => 'CLASS_IX',
                'priority'        => '9',
                'status'          => '1',
            ],
            [
                'class_name'      => 'Class-X',
                'class_code'      => 'CLASS_X',
                'priority'        => '10',
                'status'          => '1',
            ],
            [
                'class_name'      => 'Class-XI',
                'class_code'      => 'CLASS_XI',
                'priority'        => '11',
                'status'          => '1',
            ],
            [
                'class_name'      => 'Class-XII',
                'class_code'      => 'CLASS_XII',
                'priority'        => '12',
                'status'          => '1',
            ],
        ];

        foreach ($Classes as $class) {
            LmsClasses::firstOrCreate(
                ['class_code' => $class['class_code']],
                $class
            );
        }
    }
}
