diff --git a/src/Access/Impersonation.php b/src/Access/Impersonation.php index 3ac65d7c7..de68f3f58 100644 --- a/src/Access/Impersonation.php +++ b/src/Access/Impersonation.php @@ -5,7 +5,6 @@ namespace Orchid\Access; use Illuminate\Contracts\Auth\Authenticatable; -use Illuminate\Foundation\Auth\User; use Illuminate\Support\Facades\Auth; class Impersonation @@ -16,11 +15,11 @@ class Impersonation /** * Changes the current authenticated user to the given user. * - * @param User $user The user to switch to + * @param Authenticatable $user The user to switch to * * @return void */ - public static function loginAs(User $user): void + public static function loginAs(Authenticatable $user): void { // Store the original authenticated user ID in the session if it's not already there if (! session()->has(self::SESSION_NAME)) { @@ -28,7 +27,7 @@ public static function loginAs(User $user): void } // Log in the given user - self::getAuth()->loginUsingId($user->getKey()); + self::getAuth()->loginUsingId($user->getAuthIdentifier()); } /**