feat: [hr] 사원관리 연봉정보 탭 생성

- 사원 상세/수정 페이지에 연봉정보 입력 섹션 추가
- 특수 권한 사용자만 열람/수정 가능한 접근 제어 적용
- 연봉 변경 시 자동 이력 기록
- 일반 API 응답에서 연봉 데이터 노출 방지 (toArray 오버라이드)
This commit is contained in:
김보곤
2026-03-11 16:27:49 +09:00
parent 8a2a569403
commit eab39e0b29
7 changed files with 389 additions and 0 deletions

View File

@@ -9,10 +9,17 @@
class EmployeeController extends Controller
{
private const ALLOWED_SALARY_USERS = ['이의찬', '전진선', '김보곤'];
public function __construct(
private EmployeeService $employeeService
) {}
private function canViewSalary(): bool
{
return in_array(auth()->user()->name, self::ALLOWED_SALARY_USERS);
}
/**
* 사원 목록 페이지
*/
@@ -62,9 +69,13 @@ public function show(int $id): View
->orderBy('created_at', 'desc')
->get();
$canViewSalary = $this->canViewSalary();
return view('hr.employees.show', [
'employee' => $employee,
'files' => $files,
'canViewSalary' => $canViewSalary,
'salaryInfo' => $canViewSalary ? $employee->getSalaryInfo() : null,
]);
}
@@ -89,6 +100,8 @@ public function edit(int $id): View
->orderBy('created_at', 'desc')
->get();
$canViewSalary = $this->canViewSalary();
return view('hr.employees.edit', [
'employee' => $employee,
'departments' => $departments,
@@ -96,6 +109,8 @@ public function edit(int $id): View
'titles' => $titles,
'banks' => config('banks', []),
'files' => $files,
'canViewSalary' => $canViewSalary,
'salaryInfo' => $canViewSalary ? $employee->getSalaryInfo() : null,
]);
}
}