|
|
|
@ -95,7 +95,7 @@ class AgentService |
|
|
|
|
return ['status' => false, 'msg' => $this->getMessageReturn('no_data_agent')]; |
|
|
|
|
} |
|
|
|
|
$agentId = $myAgent->agent_id; |
|
|
|
|
$queryAgent = $this->modelCustomer->where('agent_id', $agentId); |
|
|
|
|
$queryAgent = $this->modelCustomer->where('agent_id', '=',$agentId); |
|
|
|
|
if (!empty($input['start_date']) && !empty($input['end_date'])) { |
|
|
|
|
$startDate = Carbon::createFromFormat('Y-m-d', $input['start_date']); |
|
|
|
|
$endDate = Carbon::createFromFormat('Y-m-d', $input['end_date'])->addDay(); |
|
|
|
@ -103,10 +103,7 @@ class AgentService |
|
|
|
|
$queryAgent->whereBetween('created_at', [$startDate->toDateString(), $endDate->toDateString()]); |
|
|
|
|
} |
|
|
|
|
if (!empty($input['keyword'])) { |
|
|
|
|
$queryAgent->where('name', 'LIKE', '%' . $input['keyword'] . '%') |
|
|
|
|
->orWhere('phone', 'LIKE', '%' . $input['keyword'] . '%') |
|
|
|
|
->orWhere('email', 'LIKE', '%' . $input['keyword'] . '%'); |
|
|
|
|
; |
|
|
|
|
$queryAgent->search($input['keyword']); |
|
|
|
|
} |
|
|
|
|
// dd($queryAgent->toSql(),$queryAgent->getBindings()); |
|
|
|
|
$listCustomer = $queryAgent->orderBy('created_at', 'desc')->get(); |
|
|
|
@ -119,7 +116,8 @@ class AgentService |
|
|
|
|
'email' => $listC->email ?? '', |
|
|
|
|
'grade' => $listC->grade ?? '', |
|
|
|
|
'date_receive' => $listC->created_at ?? '', |
|
|
|
|
'message' => $listC->msg ?? '' |
|
|
|
|
'message' => $listC->msg ?? '', |
|
|
|
|
'agent_id' => $listC->agent_id ?? '' |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|