Fixes group search

This commit is contained in:
snipe 2017-10-10 22:59:32 -07:00
parent 40ed86bfe0
commit bed7b29417

View file

@ -36,4 +36,21 @@ class Group extends SnipeModel
{
return json_decode($this->permissions, true);
}
/**
* Query builder scope to search on text
*
* @param Illuminate\Database\Query\Builder $query Query builder instance
* @param text $search Search term
*
* @return Illuminate\Database\Query\Builder Modified query builder
*/
public function scopeTextSearch($query, $search)
{
return $query->where(function ($query) use ($search) {
$query->where('name', 'LIKE', '%'.$search.'%');
});
}
}