Custom Pages By User
Hi all
I need a little advice on the best approach. I have a Reporting page whereby I select a user and then I can multiple sub pages to view different types of data about said user.
Currently I select a user and I get the URL
Then I navigate to a subpage and pass along the selectedUser
I am doing this simply by custom pages under a cluster called /rephub/10/forecast-turnover``` would be more approporate but I'm not sure how to implement this.
I thought the User resource but only an admin can see this.
Other info: an admin can see all users in the rephub but a standard user can only see themselves.
Any tips on the best way to manage this would be appreciated as I have multiple area of my system that generate reports and such.
I could be overthinking this.
4 Replies
Should I create another resource , maybe with maybe some custom pages ? And resolve the record. Then do custom logic for the report ?
The simplest answer would probably be a relation manager. Is the data simple enough to display in a table? (https://filamentphp.com/docs/3.x/panels/resources/relation-managers)
If not, you could render a custom page for
rephub/10
and then use multiple Livewire components on that custom page
And you could pass the user ID to each Livewire component so it could render the data you need
This would keep everything on one page, and you could control the different Livewire components separatelythanks for coming back to me.
no its quite complex data / tables so it doesnt really fit the generic. I ended up goign with a resource to list the users and modify the query to show all users for admins and only single user for standard. then created custom pages for the resource and added the livewire components as you mentioned
I used the resolve record so I could pass the user across each page which worked nicely
I think I always thought of Resources as list/edit/view only but it worked quite well with this use case also.