info("Initializing Native Attendance Recalculation..."); $records = AttendanceRecord::whereNotNull('clock_in')->get(); $bar = $this->output->createProgressBar(count($records)); $lateCount = 0; $earlyCount = 0; foreach ($records as $record) { // Process attendance will calculate late_hours, early_hours, total_hours // We pass false to not overwrite the user's manual status if any. $record->processAttendance(false); if ($record->is_late) $lateCount++; if ($record->is_early_departure) $earlyCount++; $bar->advance(); } $bar->finish(); $this->info("\nRecalculation Complete!"); $this->info("Found {$lateCount} late records and {$earlyCount} early departure records."); } }