User::find($manualDjId)); if ($dj) { return [ 'username' => $dj->username, 'look' => $dj->look, 'show_name' => 'Live DJ', 'is_manual' => true, ]; } } $currentSlot = RadioSchedule::with('user:id,username,look') ->active() ->where('day', $this->getCurrentDay()) ->whereTime('start_time', '<=', now()->format('H:i:s')) ->whereTime('end_time', '>=', now()->format('H:i:s')) ->first(); if ($currentSlot?->user) { return [ 'username' => $currentSlot->user->username, 'look' => $currentSlot->user->look, 'show_name' => $currentSlot->show_name, 'start_time' => $currentSlot->start_time->format('H:i'), 'end_time' => $currentSlot->end_time->format('H:i'), 'is_manual' => false, ]; } return null; } public function getTodaySchedule(): \Illuminate\Database\Eloquent\Collection { return Cache::remember('radio_schedule_today', 60, fn () => RadioSchedule::with('user:id,username,look') ->active() ->today() ->orderBy('start_time') ->get()); } public function getFullSchedule(): \Illuminate\Support\Collection { return Cache::remember('radio_schedule_all', 300, fn () => RadioSchedule::with('user:id,username,look') ->active() ->ordered() ->get() ->groupBy('day')); } private function getCurrentDay(): string { return strtolower(now()->format('l')); } }