How do i access the authenticated user in TenantFinder class? #520
Unanswered
z41dth3c0d3r
asked this question in
Q&A
Replies: 2 comments
-
FYI: one single URL and one single app with multiple tenant database with one single landload db is my structure |
Beta Was this translation helpful? Give feedback.
0 replies
-
the approach i am using not the subdomain approach |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In my use case
landlord db has all the users
there are 2 types of user roles
Administrator and Client
Admin can create Client users and can create Tenants model and assign the Client user to that created Tenant user
Tenant model is looks like this
after admin create the client user
client user can login to the app
client specific routes has "tenant" middleware
thats where the database switching happening
i have implemented my own
TenantFinder class which is extending Spatie\Multitenancy\TenantFinder\TenantFinder class
so my logic is
after the client user logs in
when they go to client specific route with tenant middleware
in the TenantFinder class i should get the current authenticated user in some way and get the user's tenant modal and return it
my problem is
in laravel spatie multitenancy package
Spatie\Multitenancy\TenantFinder\TenantFinder
will be executed
early on in request service provider
so i can't access the current authenticated user
so how do i solve this problem???
this is typical multi tenant case
this my use case (the problem i am trying to explain)
Beta Was this translation helpful? Give feedback.
All reactions