where('status', EmployeePresence::STATUS_STEPPED_OUT) ->whereNotNull('expected_return_at') ->where('expected_return_at', '<', now()) ->whereNull('return_alert_sent_at') ->with(['employee.organization']) ->get(); $count = 0; foreach ($overdue as $presence) { $notifications->employeeOverdueReturn($presence); $presence->update(['return_alert_sent_at' => now()]); $count++; } $this->info("Sent {$count} overdue return alert(s)."); return self::SUCCESS; } }