|
|
@ -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 |
|
|
|
// 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(); |
|
|
|
$customerAgentAll = $this->modelCustomer->where('phone', $dataInput['phone'])->where('agent_id', '<>', $agentId)->where('created_at', '>=', $dateNotToo)->latest()->first(); |
|
|
|
|
|
|
|
$dataInsert['created_at'] = now(); |
|
|
|
|
|
|
|
|
|
|
|
if (!empty($customerAgentAll)) { |
|
|
|
if (!empty($customerAgentAll)) { |
|
|
|
// chưa quá 15 ngày thì lấy cái agent_id cũ, đang trực thuộc |
|
|
|
// 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; |
|
|
|
$dataInsert['agent_id'] = $customerAgentAll->agent_id; |
|
|
|