소스 검색

Fixed entity type

Samson Mutunga 1 년 전
부모
커밋
4b236dcd33
1개의 변경된 파일5개의 추가작업 그리고 5개의 파일을 삭제
  1. 5 5
      app/Http/Controllers/AdminController.php

+ 5 - 5
app/Http/Controllers/AdminController.php

@@ -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) {