I am currently experimenting with a SaaS boilerplate using Filament. I currently have 3 panels to structure my app:
- A Dashboard Panel, that shows stuff for the user (his open tasks, settings, etc.) - An Admin Panel, which is only accessible for admin users - A Project Panel, which uses Filament's Multi-Tenancy to give a user access to the projects he is assigned to
Now I want to scope all my panels using a subdomain. This would be something like an "Account" model that gets created after someone subscribes to my SaaS. In each PanelServiceProvider I specified this domain as such:
$panel->domain('{account}.filament.test')
$panel->domain('{account}.filament.test')
I then registered a global Middleware with Laravel that sets the URL parameter, so I don't get crashes when Filament tries to assemble its URLs:
This second bit is a bit hacky, it's just there to prove my concept. In the finished app I would try to resolve the real 'Account' model from the database and redirect to a subscription-page, if no account has been found or the authenticated user does not belong to the account instance. In my Filament Panels, all resources would access the account url parameter in a global scope to ensure that I only display stuff from the correct account.
I was just wondering, if this is an approach that would work, or if I might be missing some Settings for this use case that might be available in Filament.