<?php

namespace Database\Seeders;

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

class entry_timeSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $entryTimes = [
            ['entry_time' => '06:30:00', 'exit_time' => '07:30:00', 'period' => 'AM', 'is_active' => true],
            ['entry_time' => '07:30:00', 'exit_time' => '08:30:00', 'period' => 'AM', 'is_active' => true],
            ['entry_time' => '18:00:00', 'exit_time' => '19:00:00', 'period' => 'PM', 'is_active' => true],
            ['entry_time' => '19:00:00', 'exit_time' => '20:00:00', 'period' => 'PM', 'is_active' => true],
        ];
        foreach ($entryTimes as $entryTime) {
            $exists = Entry_time::where('entry_time', $entryTime['entry_time'])
            ->where('exit_time', $entryTime['exit_time'])
            ->where('period', $entryTime['period'])
            ->exists();

            if (!$exists) {
            Entry_time::create($entryTime);
            }
        }
    }
}
