Open maherelgamil opened 2 years ago
We do this too, but we don't have a strict requirement to switch domains when we impersonate a user. For Spatie's multi tenancy solution you can use middleware to set the tenant. This assumes you have a relation set on your User-model.
public function handle(Request $request, Closure $next): mixed
{
if (app('impersonate')->isImpersonating()) {
auth()->user()->tenant->makeCurrent();
}
return $next($request);
}
We're not using this in production yet but I have not found any issues with it.
Hey,
I have multi-tenancy project with custom domains,
So, how can I impersonate users from other domains?
Thanks