|
@@ -858,15 +858,15 @@ class AdminController extends Controller
|
|
|
return $this->fail('Invalid entity type');
|
|
|
}
|
|
|
$records = [];
|
|
|
- if($type === 'client'){
|
|
|
+ if($type === 'Client'){
|
|
|
$clients = Client::query();
|
|
|
$clients = $clients->where('is_active', true);
|
|
|
|
|
|
$clients = $clients->where(function ($q) use ($term) {
|
|
|
- $q->orWhereRaw('LOWER(name_first::text) LIKE ?', ['%' . $term . '%'])
|
|
|
- ->orWhereRaw('LOWER(name_last::text) LIKE ?', ['%' . $term . '%'])
|
|
|
- ->orWhereRaw('LOWER(email_address::text) LIKE ?', ['%' . $term . '%'])
|
|
|
- ->orWhereRaw('cell_number LIKE ?', ['%' . $term . '%']);
|
|
|
+ return $q->orWhereRaw('LOWER(name_first::text) ILIKE ?', ['%' . $term . '%'])
|
|
|
+ ->orWhereRaw('LOWER(name_last::text) ILIKE ?', ['%' . $term . '%'])
|
|
|
+ ->orWhereRaw('LOWER(email_address::text) ILIKE ?', ['%' . $term . '%'])
|
|
|
+ ->orWhereRaw('cell_number ILIKE ?', ['%' . $term . '%']);
|
|
|
});
|
|
|
$clients = $clients->orderBy('name_first', 'ASC')->limit(10)->get();
|
|
|
$clientsData = $clients->map(function($client) {
|