Pseudo multi tenant setup using panels w/ a parameter (or maybe something else?)

Heya everyone! I'm in the process of upgrading from Filament v2, but I have a non standard setup and I am not able to port it to Filament v3. Sorry for the wall of text, I'm gonna be as clear and concise as possible. I have an internal admin-only dashboard, that has several "global" pages. One of those pages is a list of restaurants. When navigating to the View page of a Restaurant, I move to a different "context" specific to that restaurant. E.g. the links in the sidebar change and when opened the pages show data from that specific restaurant (their orders only, their holidays, etc..) To be clear, this is not really a multi tenant setup: restaurant owners can't access Filament, it's only used internally to separate the data. I achieved it by using the now deprecated https://github.com/artificertech/filament-multi-context plugin. We have two contexts, one of them has a parameter to store the "current restaurant". We then manipulate routes and filter resources using several custom traits/tricks, some of them a bit obscure (lots of trial and error). Adding a pic for clarity. Fast forward a few years, I'd like to upgrade to Filament v3 and my initial thought was to replicate it using two panels. I tried adding a parameter to the route of the "nested" panel (restaurants/{id}) but it breaks a lot of stuff (login/logout links and more) and I would like to stay a bit more "vanilla". Other things that look appropriate might be Clusters and/or Sub-Navigation, but after spending a few hours with those I haven't been able to make them work as I would like to. I could try "hammering until it works" it but maybe you guys can suggest a better way? Thanks!
No description
Solution:
Sorry for the late update, I've been busy these past few weeks. Anyway, thanks for your suggestions! I had already tried using clusters, but it looked like I could only use them to group resources when I would also like to scope the results by the current Restaurant. ...
Jump to solution
4 Replies
Daniele
Daniele3mo ago
Bump, any ideas? I'm not super confident in my Filament knowledge, maybe I'm making it harder than it needs to be Bump
toeknee
toeknee3mo ago
Why not use the cluster menu instead? Or sub navigation and just have roles access for each of the menu items? i.e. if role = admin should all items in the left, if role = user show all int he right? Else... Build it the same in two panels.
Dennis Koch
Dennis Koch3mo ago
Idea: - Add a middleware that checks, if you are on a Restaurant route - Get current panel Filament::getCurrentPanel() - Overwrite the navigation using the navigation builder: https://filamentphp.com/docs/3.x/panels/navigation#advanced-navigation-customization
Solution
Daniele
Daniele2mo ago
Sorry for the late update, I've been busy these past few weeks. Anyway, thanks for your suggestions! I had already tried using clusters, but it looked like I could only use them to group resources when I would also like to scope the results by the current Restaurant. I also tried to implement Dennis's idea. Initially, it worked, but then I got stuck in a slew of Livewire errors that I was not able to solve. I still can't fully wrap my head around the Livewire stuff. In the end, I managed to solve it using Multi-tenancy (not sure how I missed it the first time). I set up two panels: an "admin" panel with all the global resources, and a "restaurants" panel with a Restaurant tenant configuration (that automatically scopes everything). Setting up the links between the two panels was a bit tricky, but aside from that, the docs were very thorough, and I managed to do everything I wanted. Thanks again for giving me some pointers!
Want results from more Discord servers?
Add your server
More Posts
How to close action confirmation modal after form validate fails?I have a custom livewire component that has a form with rules and submit action. ```public functioSpatie Translatable plugin: Possible to have persistent LocaleSwitcher?Is it possible to have the LocaleSwitcher be persistent when navigating through List and Edit ResourFor IconColumn, only show boolean icon when true?Hi there, I have an icon column (see screenshot) but I only want an icon to display when the value iGet current value of table filterI am trying to filter the results of a SelectFilter based on the boolean value of another TableFilteUsing a custom user model in Export actionHi.. I am trying to use Admin model with export action. I see this documentation: https://filamenAm I the only one who often lands on V2 Documentation pages?Very often when using the Documentation Search bar (by Algolia) or hitting a Google result, I end onis it possible to set the existing avatar on page load?Ony my edit profile page, the user can select an avatar using the file upload component. After it's Make user profile form wider?Can't seem to make the form on the user profile page wider. I tried extraAttributes and attaching a Origin https://[xxxxxx].test is not allowed by Access-Control-Allow-Origin. Status code: 200Hello, I want to retrieve an image from an other Laravel website (project) for my FileUpload. But IExport excel for custom modelI am using Custom Model UsersAdmin file is showing in notification for download but when i clicking