From 11671f3a2bc52851bd46cdca77afe72bb58e9dd4 Mon Sep 17 00:00:00 2001 From: sky121113 Date: Thu, 14 May 2026 14:33:07 +0800 Subject: [PATCH] =?UTF-8?q?[REFACTOR]=20=E4=BF=AE=E6=94=B9=E5=93=A1?= =?UTF-8?q?=E5=B7=A5=E8=AD=98=E5=88=A5=E5=8D=A1=E5=8C=AF=E5=85=A5=E9=82=8F?= =?UTF-8?q?=E8=BC=AF=EF=BC=9A=E6=94=B9=E4=BB=A5=E5=93=A1=E5=B7=A5=E7=B7=A8?= =?UTF-8?q?=E8=99=9F=E4=BD=9C=E7=82=BA=E6=AF=94=E5=B0=8D=E5=9F=BA=E6=BA=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 修改 StaffCardImportService,將 updateOrCreate 的比對欄位從 card_uid 改為 employee_id。 2. 這樣當員工補發新卡時,透過 Excel 匯入相同的員工編號即可直接更新其卡號。 --- app/Services/StaffCardImportService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Services/StaffCardImportService.php b/app/Services/StaffCardImportService.php index a4fd12c..3817ff5 100644 --- a/app/Services/StaffCardImportService.php +++ b/app/Services/StaffCardImportService.php @@ -72,14 +72,14 @@ class StaffCardImportService } try { - // Update or create based on card_uid and company_id + // Update or create based on employee_id and company_id StaffCard::updateOrCreate( [ 'company_id' => $data['company_id'], - 'card_uid' => $data['card_uid'], + 'employee_id' => $data['employee_id'], ], [ - 'employee_id' => $data['employee_id'], + 'card_uid' => $data['card_uid'], 'name' => $data['name'], 'notes' => $data['notes'], 'status' => 'active',