|
|
@ -87,6 +87,7 @@ class AgentService |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function myCustomer($input){ |
|
|
|
public function myCustomer($input){ |
|
|
|
$listCustomer = []; |
|
|
|
$listCustomer = []; |
|
|
|
|
|
|
|
$finalAgentData = []; |
|
|
|
$myAgent = $this->modelAgentUser->where('user_id', auth()->user()->id)->latest()->first(); |
|
|
|
$myAgent = $this->modelAgentUser->where('user_id', auth()->user()->id)->latest()->first(); |
|
|
|
if(empty($myAgent) || empty($myAgent->agent_id)){ |
|
|
|
if(empty($myAgent) || empty($myAgent->agent_id)){ |
|
|
|
return ['status' => false, 'msg' => $this->getMessageReturn('no_data_agent')]; |
|
|
|
return ['status' => false, 'msg' => $this->getMessageReturn('no_data_agent')]; |
|
|
@ -100,7 +101,20 @@ class AgentService |
|
|
|
$queryAgent->where('name', 'LIKE', '%' . $input['keyword'] . '%'); |
|
|
|
$queryAgent->where('name', 'LIKE', '%' . $input['keyword'] . '%'); |
|
|
|
} |
|
|
|
} |
|
|
|
$listCustomer = $queryAgent->orderBy('name', 'asc')->get(); |
|
|
|
$listCustomer = $queryAgent->orderBy('name', 'asc')->get(); |
|
|
|
return ['status' => true, 'data' => $listCustomer, 'msg' => $this->getMessageReturn('success')]; |
|
|
|
if(!empty($listCustomer)){ |
|
|
|
|
|
|
|
foreach($listCustomer as $listC){ |
|
|
|
|
|
|
|
$finalAgentData[] = [ |
|
|
|
|
|
|
|
'id' => $listC->id??'', |
|
|
|
|
|
|
|
'guest_name' => $listC->name??'', |
|
|
|
|
|
|
|
'phone' => $listC->phone??'', |
|
|
|
|
|
|
|
'email' => $listC->email??'', |
|
|
|
|
|
|
|
'grade' => $listC->grade??'', |
|
|
|
|
|
|
|
'date_receive' => $listC->created_at??'', |
|
|
|
|
|
|
|
'message' => $listC->msg??'' |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return ['status' => true, 'data' => $finalAgentData, 'msg' => $this->getMessageReturn('success')]; |
|
|
|
} |
|
|
|
} |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Summary of formatCreateCustomer |
|
|
|
* Summary of formatCreateCustomer |
|
|
|