header('HX-Request')) { return response('', 200)->header('HX-Redirect', route('hr.payrolls.index')); } $isAllowedUser = in_array(auth()->user()->name, self::ALLOWED_PAYROLL_USERS); $isDevSuperAdmin = ! app()->environment('production') && auth()->user()->isSuperAdmin(); if (! $isAllowedUser && ! $isDevSuperAdmin) { return view('hr.payrolls.restricted'); } $stats = $this->payrollService->getMonthlyStats(); $departments = $this->payrollService->getDepartments(); $employees = $this->payrollService->getActiveEmployees(); $settings = $this->payrollService->getSettings(); $statusMap = Payroll::STATUS_MAP; return view('hr.payrolls.index', [ 'stats' => $stats, 'departments' => $departments, 'employees' => $employees, 'settings' => $settings, 'statusMap' => $statusMap, ]); } }