@php use App\Models\Item; use App\Models\Calendar; $foods = Item::orderBy('created_at', 'desc')->paginate(5); // $day = Calendar::where('set', 1) // ->where('day', now()->format('l'))->first(); $todayDate = date("Y-m-d"); $day = Calendar::where('set', 1) ->where('start_date', $todayDate) ->orWhere('start_date', '>', $todayDate) ->orWhere('end_date', '<', $todayDate) ->where('end_date', $todayDate) ->first(); @endphp {{-- --}}
@if ($foods->count()> 0)

Latest Products

@foreach ($foods as $item)
@if ($day && $item->exempt !== 1)
Closed
@else
Selling
@endif
{{$item->name}}
₦{{$item->price}}
@endforeach
{{$foods->links()}} @endif
{{-- --}}