diff --git a/src/Models/Impersonate.php b/src/Models/Impersonate.php index eaa7985..9ab06d9 100644 --- a/src/Models/Impersonate.php +++ b/src/Models/Impersonate.php @@ -38,6 +38,14 @@ public function canBeImpersonated() */ public function impersonate(Model $user, $guardName = null) { + if ($this->canImpersonate() === false) { + return false; + } + + if ($user->canBeImpersonated() === false) { + return false; + } + return app(ImpersonateManager::class)->take($this, $user, $guardName); }