fix: [payroll] 중복 급여 등록 시 자동으로 수정 모드 전환
- store 시 동일 사원/기간 레코드가 존재하면 updatePayroll로 전환 - 기존 INSERT 실패(500) 대신 정상 수정 처리
This commit is contained in:
@@ -124,9 +124,8 @@ public function storePayroll(array $data): Payroll
|
||||
if ($existing->trashed()) {
|
||||
$existing->forceDelete();
|
||||
} else {
|
||||
throw new \InvalidArgumentException(
|
||||
"해당 직원의 {$data['pay_year']}년 {$data['pay_month']}월 급여가 이미 등록되어 있습니다."
|
||||
);
|
||||
// 이미 존재하는 레코드가 있으면 수정 모드로 전환
|
||||
return $this->updatePayroll($existing->id, $data);
|
||||
}
|
||||
}
|
||||
$familyCount = $data['family_count'] ?? $this->resolveFamilyCount($data['user_id']);
|
||||
|
||||
Reference in New Issue
Block a user