diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php index eb93f802f3..e861c5cd7d 100644 --- a/app/Http/Controllers/Api/UsersController.php +++ b/app/Http/Controllers/Api/UsersController.php @@ -67,7 +67,7 @@ class UsersController extends Controller } if ($request->has('group_id')) { - $users = $users->ByGroup($request->has('group_id')); + $users = $users->ByGroup($request->get('group_id')); } if ($request->has('department_id')) { diff --git a/app/Models/User.php b/app/Models/User.php index 5df4a81ef6..fd18d50921 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -381,7 +381,7 @@ class User extends SnipeModel implements AuthenticatableContract, CanResetPasswo public function scopeByGroup($query, $id) { return $query->whereHas('groups', function ($query) use ($id) { - $query->where('id', '=', $id); + $query->where('groups.id', '=', $id); }); }