feat: [users] 사용자 수정 화면에 소속 부서 선택 기능 추가

- UserController: profile 쿼리에 department_id 추가
- edit.blade.php: 소속 부서 select 드롭다운 UI 추가
- UpdateUserRequest: department_id 유효성 검증 규칙 추가
- UserService: tenant_user_profiles에 department_id 저장 로직 추가
This commit is contained in:
김보곤
2026-02-28 12:14:14 +09:00
parent 162f630051
commit b2d639265c
4 changed files with 23 additions and 2 deletions

View File

@@ -280,6 +280,9 @@ public function updateUser(int $id, array $data): bool
if (array_key_exists('employee_status', $data)) {
$profileFields['employee_status'] = $data['employee_status'] ?: 'active';
}
if (array_key_exists('department_id', $data)) {
$profileFields['department_id'] = $data['department_id'] ?: null;
}
if (! empty($profileFields)) {
DB::table('tenant_user_profiles')->updateOrInsert(
['tenant_id' => $tenantId, 'user_id' => $id],
@@ -289,7 +292,7 @@ public function updateUser(int $id, array $data): bool
}
// role_ids, department_ids, position/job_title은 User 모델의 fillable이 아니므로 제거
unset($data['role_ids'], $data['department_ids'], $data['position_key'], $data['job_title_key'], $data['employee_status']);
unset($data['role_ids'], $data['department_ids'], $data['position_key'], $data['job_title_key'], $data['employee_status'], $data['department_id']);
return $user->update($data);
}