diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php index e861c5cd7d..6420a19b27 100644 --- a/app/Http/Controllers/Api/UsersController.php +++ b/app/Http/Controllers/Api/UsersController.php @@ -43,7 +43,9 @@ class UsersController extends Controller 'users.last_login', 'users.deleted_at', 'users.department_id', - 'users.activated' + 'users.activated', + 'users.avatar', + ])->with('manager', 'groups', 'userloc', 'company', 'department','throttle','assets','licenses','accessories','consumables') ->withCount('assets','licenses','accessories','consumables'); $users = Company::scopeCompanyables($users); diff --git a/app/Http/Transformers/UsersTransformer.php b/app/Http/Transformers/UsersTransformer.php index 3f8d99489d..8b283da8d0 100644 --- a/app/Http/Transformers/UsersTransformer.php +++ b/app/Http/Transformers/UsersTransformer.php @@ -23,6 +23,7 @@ class UsersTransformer { $array = [ 'id' => (int) $user->id, + 'avatar' => e($user->present()->gravatar), 'name' => e($user->first_name).' '.($user->last_name), 'firstname' => e($user->first_name), 'lastname' => e($user->last_name), diff --git a/app/Presenters/UserPresenter.php b/app/Presenters/UserPresenter.php index 0b88e09085..601c33b051 100644 --- a/app/Presenters/UserPresenter.php +++ b/app/Presenters/UserPresenter.php @@ -34,6 +34,15 @@ class UserPresenter extends Presenter "title" => trans('general.id'), "visible" => false ], + [ + "field" => "avatar", + "searchable" => false, + "sortable" => false, + "switchable" => true, + "title" => 'Avatar', + "visible" => false, + "formatter" => "imageFormatter" + ], [ "field" => "company", "searchable" => true,