From 7d64ab315810f90a6d23191a3f33c094a1debff1 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 24 Oct 2017 04:39:47 -0700 Subject: [PATCH] Fixes #4294 - pass correct group ID for group user listings --- app/Http/Controllers/Api/UsersController.php | 2 +- app/Models/User.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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); }); }