Update scopeAssignedSearch in Asset

This commit is contained in:
Marcus Moore 2023-05-22 16:54:54 -07:00
parent 2d86c8f030
commit 64e83ed9f5
No known key found for this signature in database

View file

@ -1348,7 +1348,13 @@ class Asset extends Depreciable
})->orWhere(function ($query) use ($search) {
$query->where('assets_users.first_name', 'LIKE', '%'.$search.'%')
->orWhere('assets_users.last_name', 'LIKE', '%'.$search.'%')
->orWhereRaw('CONCAT('.DB::getTablePrefix().'assets_users.first_name," ",'.DB::getTablePrefix().'assets_users.last_name) LIKE ?', ["%$search%"])
->orWhereRaw(
$this->buildMultipleColumnSearch([
DB::getTablePrefix().'assets_users.first_name',
DB::getTablePrefix().'assets_users.last_name',
]),
["%{$search}%"]
)
->orWhere('assets_users.username', 'LIKE', '%'.$search.'%')
->orWhere('assets_locations.name', 'LIKE', '%'.$search.'%')
->orWhere('assigned_assets.name', 'LIKE', '%'.$search.'%');