From 78e0af383d729718aa525cdd8fb382600c5fe2ad Mon Sep 17 00:00:00 2001 From: madd15 Date: Thu, 30 Jul 2015 14:08:03 +0930 Subject: [PATCH] Fix user firstname/lastname search --- app/models/Asset.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/models/Asset.php b/app/models/Asset.php index 9fcad6f461c8..f955c9a90111 100755 --- a/app/models/Asset.php +++ b/app/models/Asset.php @@ -420,10 +420,12 @@ public function scopeTextSearch($query, $search) $query->where('name','LIKE','%'.$search.'%'); }); })->orWhere(function($query) use ($search) { - $query->whereHas('assigneduser', function($query) use ($search) { - $query->where('first_name','LIKE','%'.$search.'%') - ->orWhere('last_name','LIKE','%'.$search.'%'); - }); + $query->whereHas('assigneduser', function($query) use ($search) { + $query->where(function($query) use ($search) { + $query->where('first_name','LIKE','%'.$search.'%') + ->orWhere('last_name','LIKE','%'.$search.'%'); + }); + }); })->orWhere('name','LIKE','%'.$search.'%') ->orWhere('asset_tag','LIKE','%'.$search.'%') ->orWhere('serial','LIKE','%'.$search.'%')