From 799a93c46a198a8235bbce1527ea7bf4929129c2 Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 17 Jul 2020 12:11:32 -0700 Subject: [PATCH] Allow for email/username search on users --- app/Http/Controllers/Api/UsersController.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php index 06d7661aa7..0c735661eb 100644 --- a/app/Http/Controllers/Api/UsersController.php +++ b/app/Http/Controllers/Api/UsersController.php @@ -76,6 +76,14 @@ class UsersController extends Controller $users = $users->where('users.location_id', '=', $request->input('location_id')); } + if ($request->filled('email')) { + $users = $users->where('users.email', '=', $request->input('email')); + } + + if ($request->filled('username')) { + $users = $users->where('users.username', '=', $request->input('username')); + } + if ($request->filled('group_id')) { $users = $users->ByGroup($request->get('group_id')); }