@php use App\Models\MasterEquipment; use Carbon\Carbon; // $expires = MasterEquipment::whereMonth('cal_due_date', date('m') + 1) // ->orderBy('cal_due_date') // ->get(); $expires = MasterEquipment::whereBetween('cal_due_date', [now()->startOfMonth()->format('Y-m-d'), now()->addMonth()->endOfMonth()->format('Y-m-d')]) ->orWhereDate('cal_due_date', '<=', now()->format('Y-m-d')) ->get(); // REMOVING RENEWED CERTIFICATES FROM COLLECTION $expires = $expires->reject(function($data) { return $data->renewed == 1; }); @endphp