integer('year', now()->year); $month = $request->integer('month', now()->month); $hrSettings = app(HRSettings::class); return Inertia::render('admin/hr/attendance/index', [ 'attendances' => $this->service->getByMonth($year, $month), 'todayAttendance' => $this->service->getToday(), 'currentYear' => $year, 'currentMonth' => $month, 'monthStats' => $this->service->getMonthStats($year, $month), 'hrSettings' => [ 'scheduled_check_in_time' => $hrSettings->scheduled_check_in_time, 'scheduled_check_out_time' => $hrSettings->scheduled_check_out_time, ], ]); } public function store(AttendanceRequest $request): RedirectResponse { return $this->handleAction( fn () => $this->service->checkIn($request->validated()), 'Berhasil check-in.', 'admin.hr.attendances.index' ); } public function update(AttendanceRequest $request, Attendance $attendance): RedirectResponse { return $this->handleAction( fn () => $this->service->checkOut($attendance, $request->validated()), 'Berhasil check-out.', 'admin.hr.attendances.index' ); } public function byDate(Request $request): ?array { $date = $request->query('date', now()->toDateString()); return $this->service->getByDate($date); } }