From 910fa2560efdf455f320b2894d9c58f3e150bd45 Mon Sep 17 00:00:00 2001 From: nocode Date: Mon, 15 Jul 2024 16:19:03 +0700 Subject: [PATCH] Update API add Customer --- Modules/Agents/Services/AgentService.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Modules/Agents/Services/AgentService.php b/Modules/Agents/Services/AgentService.php index 39eba56..ac56afe 100644 --- a/Modules/Agents/Services/AgentService.php +++ b/Modules/Agents/Services/AgentService.php @@ -68,10 +68,8 @@ class AgentService $dataInsert['agent_id'] = $agentId; $result = $this->modelCustomer->insert($dataInsert); // nếu agent id cũ != cái hiện tại check - $checkOldCustomer = $this->modelCustomer->where('phone', $dataInput['phone'])->where('agent_id', '=',$agentId)->latest()->first(); - if($agentId != $checkOldCustomer->agent_id){ - $this->modelCustomer->where('phone', $dataInput['phone'])->where('agent_id', '<>',$agentId)->where('created_at', '<=', $dateNotToo)->delete(); - } + $this->modelCustomer->where('phone', $dataInput['phone'])->where('agent_id', '<>',$agentId)->delete(); + } \DB::commit();