|
|
@ -72,7 +72,13 @@ class AgentService |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!empty($customerAgentAllTime[0])){ |
|
|
|
if(!empty($customerAgentAllTime[0])){ |
|
|
|
$differenceInDays = $today->diffInDays($customerAgentAllTime[0]->created_at); |
|
|
|
// $differenceInDays = $today->diffInDays($customerAgentAllTime[0]->created_at); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$dateNow = Carbon::create($today->year, $today->month, $today->day); // current date |
|
|
|
|
|
|
|
$datecurrent = Carbon::create($customerAgentAllTime[0]->created_at->year, $customerAgentAllTime[0]->created_at->month, $customerAgentAllTime[0]->created_at->day); // Ngày muốn trừ |
|
|
|
|
|
|
|
$differenceInDays = $dateNow->diffInDays($datecurrent); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// dd($today, $customerAgentAllTime[0]->created_at, $differenceInDays); |
|
|
|
if($differenceInDays > self::DISTANCE_DAY_DEFAULT){ |
|
|
|
if($differenceInDays > self::DISTANCE_DAY_DEFAULT){ |
|
|
|
$dataInsert['agent_id'] = $agentId; |
|
|
|
$dataInsert['agent_id'] = $agentId; |
|
|
|
$this->modelCustomer->insert($dataInsert); |
|
|
|
$this->modelCustomer->insert($dataInsert); |
|
|
|