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();