NEW LIST AGENT FOR USER

main
nocode 1 year ago
parent 0d10ad5801
commit e6f210314a
  1. 4
      Modules/Agents/Services/AgentService.php

@ -59,7 +59,7 @@ 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;
@ -109,7 +109,7 @@ class AgentService
;
}
// dd($queryAgent->toSql(),$queryAgent->getBindings());
$listCustomer = $queryAgent->orderBy('name', 'asc')->get();
$listCustomer = $queryAgent->orderBy('created_at', 'desc')->get();
if (!empty($listCustomer)) {
foreach ($listCustomer as $listC) {
$finalAgentData[] = [

Loading…
Cancel
Save