public function endForgottenShifts() { $forgottenShifts = Shift::where('clockOut', '=', '0000-00-00 00:00:00')->get(); foreach ($forgottenShifts as $shift) { $cout = new DateTime(); $shift->clockOut = $cout->format('Y-m-d H:i:s'); $shift->save(); } //if the forgotten shifts is empty, then no email is sent if (!$forgottenShifts->isEmpty()) { Shift::sendNotificationEmail($forgottenShifts); } }