Reuse the same Resources in multiple panels
Hi everyone, I am building two panels;
The first panel is for admin use and the second for staff members. In the admin panel I have access to all the data stored in my database, however the staff panel should only display the data related to the authenticated user. What is the best structure to follow as far as this scenario? There are several resources that I'd like to reuse in both panels but I should only filter the data on a admin/staff basis. Any suggestions? Thanks!
7 Replies
@Patrick Boivin Hi, are you able to advice me on this one by any chance, please?
Should be possible... are both panels without multi-tenancy?
Yes, they are
Ok so what I did instead, I am using a Trait in the two Resources created in the Admin and Staff pane;, in this way, there's going to be only one table/form implementation for both resources
I don't think you need to duplicate the resources, you could configure them with panel discovery:
And use
Filament::getCurrentPanel()
to show/hide different things in the shared resources (Blog in my example)Thank you very much
have you tried displaying different pages in the resource according to user?