From f42bd3a144903a16949f1e8afe095aafd584654e Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 26 Oct 2020 14:58:45 -0700 Subject: [PATCH] Fixed #8613 - Added deleted_at to user API response, added all=true to include deleted and not-deleted in one call --- app/Http/Controllers/Api/UsersController.php | 2 ++ app/Http/Transformers/UsersTransformer.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php index 153c20f17b..63ed6ccfc3 100644 --- a/app/Http/Controllers/Api/UsersController.php +++ b/app/Http/Controllers/Api/UsersController.php @@ -68,6 +68,8 @@ class UsersController extends Controller if (($request->filled('deleted')) && ($request->input('deleted')=='true')) { $users = $users->onlyTrashed(); + } elseif (($request->filled('all')) && ($request->input('deleted')=='true')) { + $users = $users->withTrashed(); } if ($request->filled('company_id')) { diff --git a/app/Http/Transformers/UsersTransformer.php b/app/Http/Transformers/UsersTransformer.php index 5f844d5883..9a8b0a098f 100644 --- a/app/Http/Transformers/UsersTransformer.php +++ b/app/Http/Transformers/UsersTransformer.php @@ -54,7 +54,6 @@ class UsersTransformer 'activated' => ($user->activated =='1') ? true : false, 'two_factor_activated' => ($user->two_factor_active()) ? true : false, 'two_factor_enrolled' => ($user->two_factor_active_and_enrolled()) ? true : false, - 'assets_count' => (int) $user->assets_count, 'licenses_count' => (int) $user->licenses_count, 'accessories_count' => (int) $user->accessories_count, @@ -63,6 +62,7 @@ class UsersTransformer 'created_at' => Helper::getFormattedDateObject($user->created_at, 'datetime'), 'updated_at' => Helper::getFormattedDateObject($user->updated_at, 'datetime'), 'last_login' => Helper::getFormattedDateObject($user->last_login, 'datetime'), + 'deleted_at' => ($user->deleted_at) ? Helper::getFormattedDateObject($user->deleted_at, 'datetime') : null, ]; $permissions_array['available_actions'] = [