From 3d295e1ca75c62a93633008ba7d622bc1978e7e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Fri, 27 Feb 2026 10:07:07 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20[employee]=20=EB=B6=80=EC=96=91=EA=B0=80?= =?UTF-8?q?=EC=A1=B1=20=EC=82=AD=EC=A0=9C=EA=B0=80=20=EC=84=9C=EB=B2=84?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EB=B0=98=EC=98=81=EB=90=98=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - hx-put → hx-post + _method=PUT (method spoofing) 변경 서버 Nginx/PHP-FPM에서 PUT body 파싱 이슈 방지 - dependents_submitted 히든 마커 추가 모든 부양가족 삭제 시 dependents 키가 폼에 없어도 서버에서 인식 - Controller에서 마커 확인 후 빈 배열로 처리하여 삭제 반영 --- app/Http/Controllers/Api/Admin/HR/EmployeeController.php | 5 +++++ resources/views/hr/employees/edit.blade.php | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/Admin/HR/EmployeeController.php b/app/Http/Controllers/Api/Admin/HR/EmployeeController.php index bcd8d9b6..1e11f31d 100644 --- a/app/Http/Controllers/Api/Admin/HR/EmployeeController.php +++ b/app/Http/Controllers/Api/Admin/HR/EmployeeController.php @@ -189,6 +189,11 @@ public function update(Request $request, int $id): JsonResponse 'dependents.*.is_dependent' => 'nullable|boolean', ]); + // 부양가족 섹션이 포함된 폼인데 dependents 데이터가 없으면 → 전체 삭제 + if ($request->has('dependents_submitted') && ! array_key_exists('dependents', $validated)) { + $validated['dependents'] = []; + } + try { $employee = $this->employeeService->updateEmployee($id, $validated); diff --git a/resources/views/hr/employees/edit.blade.php b/resources/views/hr/employees/edit.blade.php index d817210d..5f3f7a91 100644 --- a/resources/views/hr/employees/edit.blade.php +++ b/resources/views/hr/employees/edit.blade.php @@ -18,11 +18,12 @@ {{-- 수정 폼 --}}
+
@@ -225,6 +226,8 @@ class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:rin
+ {{-- 부양가족 전체 삭제 시에도 서버에 전달되도록 마커 --}} +