Felix Schmid
Explore posts from serversDynamically 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 🙏3 replies
Implement multi level tenancy
Hey everyone,
I'm building an application that needs to support two levels of tenancy, and I'm just curious if anyone has done that already?
The first level is that my direct customers can create their accounts, upload their logo, and configure some settings. This is going to be part of the "admin" panel. Every one of these tenants can specify a custom subdomain or add a completely custom domain. They should be able to invite users to their tenant and so on.
A second panel, a white-labeled panel, should be accessible through the specified subdomain for their customers. It should use the brand color and logo that the tenant has added in the admin panel. Users should be able to register an account in this white-labeled panel, manage their resources, but as well create and switch between multiple accounts (the second level of tenancy).
Is this explanation halfway understandable, and has anyone already solved something like that? I'm just looking for some experience reports or best practices.
8 replies