فهرست منبع

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