whereNotIn('status', $exempt) ->where('overdue', false) ->whereDate('due_date', '<', $today) ->get(); foreach ($overdue as $invoice) { $invoice->overdue = true; printf("Invoice %s is OVERDUE \n", $invoice->invoice_number); $invoice->save(); } } }