Feature - allow search on group names

This commit is contained in:
snipe 2016-10-31 18:27:34 -07:00
parent 25bd1acab5
commit c47d391946

View file

@ -389,6 +389,11 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
$query->where('locations.name', 'LIKE', '%'.$search.'%');
});
})
->orWhere(function ($query) use ($search) {
$query->whereHas('groups', function ($query) use ($search) {
$query->where('groups.name', 'LIKE', '%'.$search.'%');
});
})
// Ugly, ugly code because Laravel sucks at self-joins
->orWhere(function ($query) use ($search) {