diff --git a/Modules/Agents/Services/AgentService.php b/Modules/Agents/Services/AgentService.php index 6c2cd07..b1c600a 100644 --- a/Modules/Agents/Services/AgentService.php +++ b/Modules/Agents/Services/AgentService.php @@ -58,7 +58,8 @@ class AgentService // tìm các dữ liệu từ ngày hiện tại trừ đi không được quá 15 ngày $customerAgentAll = $this->modelCustomer->where('phone', $dataInput['phone'])->where('agent_id', '<>', $agentId)->where('created_at', '>=', $dateNotToo)->latest()->first(); - + $dataInsert['created_at'] = now(); + if (!empty($customerAgentAll)) { // chưa quá 15 ngày thì lấy cái agent_id cũ, đang trực thuộc $dataInsert['agent_id'] = $customerAgentAll->agent_id;