feat: HR 모델 userProfile 관계 추가 및 서비스 개선

## 모델 개선
- Leave: userProfile relation 추가
- Salary: userProfile relation 추가
- TenantUserProfile: department, position 관계 및 label accessor 추가

## 서비스 개선
- LeaveService: userProfile eager loading 추가
- SalaryService: 사원 정보 조회 개선
- CardService: 관계 정리 및 개선
- AttendanceService: 조회 기능 개선

## 시더
- DummySalarySeeder 추가
- DummyCardSeeder 멀티테넌트 지원 개선
- DummyDataSeeder에 급여 시더 등록

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-26 01:32:07 +09:00
parent 2017b8fc79
commit 0fef26f42a
11 changed files with 323 additions and 19 deletions

View File

@@ -17,7 +17,11 @@ public function index(array $params): LengthAwarePaginator
$query = Salary::query()
->where('tenant_id', $tenantId)
->with(['employee:id,name,employee_number', 'employee.department', 'employee.position', 'employee.rank']);
->with([
'employee:id,name,user_id,email',
'employeeProfile' => fn($q) => $q->where('tenant_id', $tenantId),
'employeeProfile.department:id,name',
]);
// 검색 필터 (직원명)
if (!empty($params['search'])) {
@@ -78,7 +82,11 @@ public function show(int $id): Salary
return Salary::query()
->where('tenant_id', $tenantId)
->with(['employee:id,name,employee_number', 'employee.department', 'employee.position', 'employee.rank'])
->with([
'employee:id,name,user_id,email',
'employeeProfile' => fn($q) => $q->where('tenant_id', $tenantId),
'employeeProfile.department:id,name',
])
->findOrFail($id);
}
@@ -173,7 +181,11 @@ public function update(int $id, array $data): Salary
$salary->updated_by = $userId;
$salary->save();
return $salary->fresh()->load(['employee:id,name,employee_number', 'employee.department', 'employee.position', 'employee.rank']);
return $salary->fresh()->load([
'employee:id,name,user_id,email',
'employeeProfile' => fn($q) => $q->where('tenant_id', $tenantId),
'employeeProfile.department:id,name',
]);
});
}
@@ -215,7 +227,11 @@ public function updateStatus(int $id, string $status): Salary
$salary->updated_by = $userId;
$salary->save();
return $salary->load(['employee:id,name,employee_number', 'employee.department', 'employee.position', 'employee.rank']);
return $salary->load([
'employee:id,name,user_id,email',
'employeeProfile' => fn($q) => $q->where('tenant_id', $tenantId),
'employeeProfile.department:id,name',
]);
});
}