Skip to content

Commit

Permalink
Fix user firstname/lastname search
Browse files Browse the repository at this point in the history
  • Loading branch information
madd15 committed Jul 30, 2015
1 parent 8bedaf7 commit 78e0af3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/models/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.'%')
Expand Down

0 comments on commit 78e0af3

Please sign in to comment.