From 65d9cc6642d353a0d084f06dcdc053d9ac8b4578 Mon Sep 17 00:00:00 2001 From: jose123v <109558925+jose123v@users.noreply.github.com> Date: Wed, 28 Feb 2024 09:52:32 -0500 Subject: [PATCH] Support 404labfr/laravel-impersonate --- src/Resolvers/UserResolver.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Resolvers/UserResolver.php b/src/Resolvers/UserResolver.php index bb04e085..a9f7d65e 100644 --- a/src/Resolvers/UserResolver.php +++ b/src/Resolvers/UserResolver.php @@ -13,6 +13,15 @@ class UserResolver implements \OwenIt\Auditing\Contracts\UserResolver */ public static function resolve() { + // supports https://github.com/404labfr/laravel-impersonate + if (app()->bound('impersonate')) { + /** @var \Lab404\Impersonate\Services\ImpersonateManager */ + $impersonate = app('impersonate'); + if ($impersonate->isImpersonating()) { + return $impersonate->findUserById($impersonate->getImpersonatorId()); + } + } + $guards = Config::get('audit.user.guards', [ \config('auth.defaults.guard') ]);