F
Filament•9mo ago
Samus_Aran

Wrapping all Panels by subdomain

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') 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: URL::defaults(['account' => Str::betweenFirst($request->url(), '://', '.')]) 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. Or maybe this is already totally fine?
3 Replies
Lara Zeus
Lara Zeus•9mo ago
this is already totally fine 🙂 done similar thing and its worked for me
bahamasoul
bahamasoul•9mo ago
@Samus_Aran working on something similar, are you able to share your code and how you got this to work? Currently having an issue with Filament trying to assemble it's URLs
Ĺ takor
Štakor•6mo ago
Please, can you share how did you do it?
Want results from more Discord servers?
Add your server