mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 22:19:41 -08:00
Add a concat to search for full name when the relationship search in the users table
This commit is contained in:
parent
c39bf7b7e6
commit
c1074000f9
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Models\Traits;
|
namespace App\Models\Traits;
|
||||||
|
|
||||||
|
use DB;
|
||||||
use App\Models\Asset;
|
use App\Models\Asset;
|
||||||
use App\Models\CustomField;
|
use App\Models\CustomField;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
@ -160,6 +161,9 @@ trait Searchable
|
||||||
}
|
}
|
||||||
|
|
||||||
$query->orWhere($table.'.'.$column, 'LIKE', '%'.$term.'%');
|
$query->orWhere($table.'.'.$column, 'LIKE', '%'.$term.'%');
|
||||||
|
if($table == 'users'){
|
||||||
|
$query->orWhereRaw('CONCAT(users.first_name ," ", users.last_name) LIKE ?', ["%$term%"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue