Dynamically set current panel
I'm building an application that consists of three panels: Admin, tenant, and customer. The admin panel is within our application domain, e.g., admin.com. Users should be able to register as a tenant where every tenant model has a database field
domain
. The tenant panel should be available at the given tenants.domain
database field / domain.
This is where it gets tricky. The customers of our tenants should be able to register as well and can also specify a custom subdomain/domain. This domain is stored in customers.domain
. Now I somehow need to dynamically decide which panel to show. If the request host is a tenant domain, it should render the tenant
panel, and if it's a customer domain, it should render the customer
panel (where I later need to inject tenant
branding information).
I've already tried using a middleware that checks the current domain (this part works) and setting the current panel via Filament::setCurrentPanel($panel)
, but it does not reliably render the correct panel. I've registered the middleware via the Laravel 11 bootstrap/app.php
bootstrapping file. The path
property for all three panels is set to /
. While the domain
of the admin panel is set to our domain, I cannot specify it for the tenant
and customer
panels.
Has anyone encountered the same problem already or have any other ideas on how to best solve this problem? Any help is really appreciated π1 Reply
Maybe you can borrow some inspiration here: https://github.com/filamentphp/filament/discussions/2058#discussioncomment-7537089 - you can look into the tenancy package as well.
GitHub
Multi Tenant App Β· filamentphp filament Β· Discussion #2058
Hello together, I have to accomplish the following task and I want to get some feedback from you. So I have to write a saas / multi tenant app. I have worked previously a little bit with filament a...