diff --git a/Modules/Agents/Services/AgentService.php b/Modules/Agents/Services/AgentService.php index bd4e4e8..ecbc2dc 100644 --- a/Modules/Agents/Services/AgentService.php +++ b/Modules/Agents/Services/AgentService.php @@ -76,6 +76,7 @@ class AgentService if($differenceInDays > self::DISTANCE_DAY_DEFAULT){ $dataInsert['agent_id'] = $agentId; $this->modelCustomer->insert($dataInsert); + $this->modelCustomer->byPhone($dataInput['phone'])->notAgent($agentId)->delete(); }else{ $dataInsert['agent_id'] = $customerAgentAllTime[0]->agent_id; $this->modelCustomer->insert($dataInsert); @@ -83,6 +84,7 @@ class AgentService }else{ $dataInsert['agent_id'] = $agentId; $this->modelCustomer->insert($dataInsert); + $this->modelCustomer->byPhone($dataInput['phone'])->notAgent($agentId)->delete(); } }