![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/clinic.corals.io/vendor/lab404/laravel-impersonate/src/ |
<?php use Illuminate\Contracts\Auth\Authenticatable; if (! function_exists('can_impersonate')) { /** * Check whether the current user is authorized to impersonate. * * @param null $guard * @return bool */ function can_impersonate(string $guard = null): bool { $guard = $guard ?? app('impersonate')->getCurrentAuthGuardName(); return app('auth')->guard($guard)->check() && app('auth')->guard($guard)->user()->canImpersonate(); } } if (! function_exists('can_be_impersonated')) { /** * Check whether the specified user can be impersonated. * * @param Authenticatable $user * @param string|null $guard * @return bool */ function can_be_impersonated(Authenticatable $user, string $guard = null): bool { $guard = $guard ?? app('impersonate')->getCurrentAuthGuardName(); return app('auth')->guard($guard)->check() && app('auth')->guard($guard)->user()->isNot($user) && $user->canBeImpersonated(); } } if (! function_exists('is_impersonating')) { /** * Check whether the current user is being impersonated. * * @param string|null $guard * @return bool */ function is_impersonating(string $guard = null): bool { $guard = $guard ?? app('impersonate')->getCurrentAuthGuardName(); return app('auth')->guard($guard)->check() && app('auth')->guard($guard)->user()->isImpersonated(); } }