diff --git a/app/Http/Controllers/API/UserController.php b/app/Http/Controllers/API/UserController.php index 0f645a7b7..c5e16c8b0 100755 --- a/app/Http/Controllers/API/UserController.php +++ b/app/Http/Controllers/API/UserController.php @@ -75,11 +75,7 @@ class UserController extends BaseController */ public function view(Request $request, $id) { - if(is_numeric($id)) { - $query = Models\User::where('id', $id); - } else { - $query = Models\User::where('email', $id); - } + $query = Models\User::where((is_numeric($id) ? 'id' : 'email'), $id); if (! is_null($request->input('fields'))) { foreach (explode(',', $request->input('fields')) as $field) {