F
Filamentβ€’8mo ago
keenminded

How to use Laravel 11 Context for Multi-Tenancy with Filament Panels?

Has anyone tried getting Filament to work with the Laravel 11 Context feature? I am trying to make multi-tenancy work using domain context to identify tenants (see: https://x.com/davidhemphill/status/1770893521748123683), and then I will use Filament's own multi-tenancy on a Project class so each project under a tenant has a dashboard and pages. Or, if that doesn't sound plausible, is there any tutorial/documentation/example of how such "nested" tenancy can be implemented? At a high level, I have a Tenant -> Multiple Projects -> each project has admins and registered users. I feel like I'm in a live Inception movie here trying to get this working properly. Some clarity or direction would be appreciated. Thank you in advance.
4 Replies
Alex Six
Alex Sixβ€’8mo ago
I don't have an answer, but I'm very keen on figuring out how this would work.
keenminded
keenmindedOPβ€’8mo ago
Hopefully, we can figure this out and post our findings here. I got things working with the tenancyforlaravel package, but it was an overkill. My other issue was that I couldn't pass tenant information to Panels because, from what I understand, the Panel builder executes before the middleware/tenancy providers, and the tenant ID was always null.
Lara Zeus
Lara Zeusβ€’8mo ago
"the tenant ID was always null" where you add tried that? I am also working in a new app with the same idea I haven't tried anything yet, but the idea I have is to use diff panel with the sub (child) tenant model and set the main (parent) tenant in a Middleware! I can access the user and get what tenant he belong to (in my case users only belong to one tenant) I am just thinking out loud here will update you when I have more πŸ™‚
keenminded
keenmindedOPβ€’8mo ago
Well, I wanted to have a main panel to manage tenants. Then tenants would have their panel and, using their subdomain, determine the tenant in the middleware and pass that info to the panel configuration. For example, as simple as having tenant's name as the title of the panel. I tried for a while, but then ended up going the tenancy package route. This was attempted using Laravel 10. Now with 11 I am trying to figure out how to use Context facade to determine the tenant and pass it in.
Want results from more Discord servers?
Add your server