Multitenancy with Spatie multitenancy package

Well first I know this has been discussed a lot here but I have a different approach I used in normal laravel project and It worked but I am getting problems trying to impliment it in filament v3* How I did it in laravel: I used spatie multitenancy package and used customr tenancy finder, 1.I have two user tables (dublication) in the landlord database and tenants database 2.when the user logs in we use the landlord connection and the users table which has tenant_id 3.laravel triggers a loginevent where I get the tenant_id and set the cookie and when the tenantFinder runs on request I just check for the cookie and set the current tenant. My problem with Filament: when user logs in the event from laravel side is not triggered hence the cookied is not set. what I tried: I tried setting the cookie using DispatchServingFilamentEvent if it is not set and it worked but later when you swicth the tenant the cookie remains and or is not cleared and or the tenantFinder for request runs before the login form is submitted causing NoCurrentTenant Exception: How well can I modify Filament to work with my approach?
1 Reply
lawre17
lawre17OP4d ago
This how I did it with a sample todo I would love some reviews to know if there somethings Ignored https://github.com/lawre17/filament_multitenancy
GitHub
GitHub - lawre17/filament_multitenancy
Contribute to lawre17/filament_multitenancy development by creating an account on GitHub.
Want results from more Discord servers?
Add your server