@php Carbon\Carbon::setLocale('en'); $currentDayName = Carbon\Carbon::now()->dayName; $currentTime = Carbon\Carbon::now()->format('H:i:s'); $tomorrowDayName = Carbon\Carbon::now()->addDay()->dayName; Carbon\Carbon::setLocale(null); $days = App\Models\Admin\Schedules\ScheduleDay::with('dailySchedule')->where('status', 1)->get(); $schedules = App\Models\Admin\Schedules\DailySchedule::with('day')->where('status', 1)->get(); foreach ($schedules ?? [] as $schedule) { if ($schedule->is_live) { $currentLiveShowEndTime = $schedule->end_time; $currentLiveShowDay = $schedule->day->name; $nextShow = $schedule ->where('start_time', '>', $currentLiveShowEndTime) ->where('name', $currentLiveShowDay) ->first(); } else { $nextShow = $schedule ::whereHas('day', function ($query) use ($currentDayName) { $query->where('name', $currentDayName); }) ->where('start_time', '>', $currentTime) ->first(); } } if (empty($nextShow)) { $nextShow = App\Models\Admin\Schedules\DailySchedule::whereHas('day', function ($query) use ($tomorrowDayName) { $query->where('name', $tomorrowDayName); }) ->orderBy('start_time', 'asc') ->where('status', 1) ->first(); } @endphp
@if ($nextShow) @endif
{{ __('Next Show') }}
@if ($nextShow)
{{ @$nextShow->host }}

{{ @$nextShow->name }}

{{ @$nextShow->description }}

@else
{{ __('No data found!') }}
@endif
@if ($nextShow)

{{ __('Show Time') }}

{{ @$nextShow->day->name }}
{{ date('g:i A', strtotime(@$nextShow->start_time)) }} - {{ date('g:i A', strtotime(@$nextShow->end_time)) }}
@endif