1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 13:34:04 +00:00

Update UserImpersonation.php

This PR adds a new session value `tenancy_impersonated_by` in the tenant scope when you are impersonating a tenant.

This is similar to how Laravel Nova adds the `nova_impersonated_by` session value and could be used to identify when you are impersonating, who is impersonating. This may be useful for additional application logic and UI niceties such as an impersonation banner.
This commit is contained in:
Nathan Daly 2022-08-13 00:09:47 +01:00 committed by GitHub
parent 747c192979
commit 45e0aad091
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -52,6 +52,10 @@ class UserImpersonation implements Feature
Auth::guard($token->auth_guard)->loginUsingId($token->user_id); Auth::guard($token->auth_guard)->loginUsingId($token->user_id);
$token->delete(); $token->delete();
session()->put(
'tenancy_impersonated_by', Auth::user()?->getAuthIdentifier()
);
return redirect($token->redirect_url); return redirect($token->redirect_url);
} }