-
-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Tenant Finder using authenticated user #53
Comments
Skip the finder and add two listeners for these events:
When the login event will be fired, do your $tenant->makeCurrent(), and when the logout event will be fired, do your $tenant->forgot(). I think it’s better for you, try and give me feedback. |
@masterix21 @freekmurze If I do the Basically I'm just trying to switch the tenant on the session level, not domain level. I'm not sure if this package persists the tenant in the session. If not, I've tried to manually store the tenant id in the session, when the |
If you call |
Last but not least, add a listener to |
Just to register, the middleware approach gave me the needed flexibility. Worked perfectly. |
Sorry for the necro bump, just curious to see what you ended up doing. I too want to abandon the whole subdomain thing and ultimately be able to attach users to multiple tenants. Question: if we just check for a tenant id in middleware, are we not losing some part of the identification pipeline this package needs? |
@dambridge, the package works if you set a tenant "as current": it does not care if you do it from a middleware or a task. |
Hi.
In my case, The Tenant is linked to User and not to domain (All tenants will access the app from the same domain).
But when I run
Auth::user()
inTenantFinder@findForRequest
I always get null.How can I access The authenticated user inside TenantFinder?
The text was updated successfully, but these errors were encountered: