Skip to content

Commit

Permalink
refs #2723 Changed type model class to interface
Browse files Browse the repository at this point in the history
  • Loading branch information
tabuna committed Nov 1, 2023
1 parent 85d9297 commit dc56e5c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Access/Impersonation.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Orchid\Access;

use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Foundation\Auth\User;
use Illuminate\Support\Facades\Auth;

class Impersonation
Expand All @@ -16,19 +15,19 @@ 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)) {
session()->put(self::SESSION_NAME, self::getAuth()->id());
}

// Log in the given user
self::getAuth()->loginUsingId($user->getKey());
self::getAuth()->loginUsingId($user->getAuthIdentifier());
}

/**
Expand Down

0 comments on commit dc56e5c

Please sign in to comment.