Closed jainsiddharth21 closed 6 months ago
@stancl Thanks for the prompt response. But, the implementation is not clear to me from this documentation https://tenancyforlaravel.com/docs/v3/features/user-impersonation/#usage. I've implemented the multi-tenancy using this documentation only.
I'm on the central domain (mydomain.com) and wants to impersonate to tenant (tenant1.mydomain.com).
When I dd(tenant()) on the /dashboard it results me null value. Is there anything wrong I'm doing ?
$user = User::find($id);
$tenant = $user->tenant; // relationship
$token = tenancy()->impersonate($tenant, $id, '/dashboard');
$domain = $user->tenantdomain->domain; // tenant1.mydomain.com
return redirect("http://$domain/impersonate/{$token->token}");
If possible could you please share the steps what I'm doing wrong to correct this or if we can connect over call that would be greatly appreciated.
Also, this redirection is also not happening. Even if I put the static https://www.google.com url or the laravel route. Can you guide me on that as well. ![Uploading Screenshot 2024-05-24 at 5.24.26 PM.png…]()
Bug description
Getting error
Call to a member function getTenantKey() on null
at linevendor/stancl/tenancy/src/Features/UserImpersonation.php:42
during user Impersonation.Steps to reproduce
Call to a member function getTenantKey() on null
at linevendor/stancl/tenancy/src/Features/UserImpersonation.php:42
Expected behavior
It should allow the admin user to be impersonated and logged into the system
Laravel version
8.83.27
stancl/tenancy version
3.6.1