diff --git a/src/Impersonate.php b/src/Impersonate.php index a00ef52..c32fc46 100644 --- a/src/Impersonate.php +++ b/src/Impersonate.php @@ -19,6 +19,8 @@ public function __construct($user = null) { parent::__construct(null, null, null); + $this->exceptOnForms(); + if (method_exists(auth()->user(), 'canImpersonate') && !auth()->user()->canImpersonate()) { $this->component = null; @@ -48,9 +50,5 @@ public function __construct($user = null) 'redirect_to' => config('nova-impersonate.redirect_to'), ]); - - $this->exceptOnForms(); - - } }