Fixes #4191 - user search

This commit is contained in:
snipe 2017-10-18 01:20:50 -07:00
parent b80d3ce50d
commit 6bd49bfb72

View file

@ -781,14 +781,11 @@ class Asset extends Depreciable
$query->where('locations.name', 'LIKE', '%'.$search.'%'); $query->where('locations.name', 'LIKE', '%'.$search.'%');
}); });
})->orWhere(function ($query) use ($search) { })->orWhere(function ($query) use ($search) {
$query->whereHas('assignedTo', function ($query) use ($search) {
$query->where('users.first_name', 'LIKE', '%'.$search.'%') $query->where('users.first_name', 'LIKE', '%'.$search.'%')
->orWhere('users.last_name', 'LIKE', '%'.$search.'%') ->orWhere('users.last_name', 'LIKE', '%'.$search.'%')
->orWhere('users.username', 'LIKE', '%'.$search.'%') ->orWhere('users.username', 'LIKE', '%'.$search.'%')
->orWhere('locations.name', 'LIKE', '%'.$search.'%') ->orWhere('locations.name', 'LIKE', '%'.$search.'%')
->orWhere('assigned_assets.name', 'LIKE', '%'.$search.'%'); ->orWhere('assigned_assets.name', 'LIKE', '%'.$search.'%');
});
})->orWhere('assets.name', 'LIKE', '%'.$search.'%') })->orWhere('assets.name', 'LIKE', '%'.$search.'%')
->orWhere('assets.asset_tag', 'LIKE', '%'.$search.'%') ->orWhere('assets.asset_tag', 'LIKE', '%'.$search.'%')
->orWhere('assets.serial', 'LIKE', '%'.$search.'%') ->orWhere('assets.serial', 'LIKE', '%'.$search.'%')