Set record in ViewRecord page
Hi, I'm creating a custom panel for a customer role. So I would like to limit the view/edit actions for this customer to only be able manage his/hers business.
So my idea is to create BusinessResource and then use the ViewBusiness to display the data using an infolist, so then I can add a new entry in the nav pointing to the view page directly.
My problem right now is that I cannot set the record in the view page.
So this is my
Business::getPages()
:
I've tried to set the record using this 3 methods but so far no luck:
But I'm still getting:
How could I achieve this? Or maybe some guidance in case there's an easier approach.
Thanks in advance π7 Replies
You aren't passing record to the route
@krekas that's the idea. To avoid passing any id in the route in order to mask the path. I can resolve the record using the logged in user.
Similar to how any generic
/profile
should work. I would like for customers to access their business details by going into /my-business
It's not that easy to create an EditPage without a record. I think it's also used in
mount()
method which you cannot override.@Dennis Koch I see. How can I achieve something like this?
I tried before creating a custom page and to add an infolist to a livewire component following https://filamentphp.com/docs/3.x/infolists/adding-an-infolist-to-a-livewire-component but it's not clear. It tells you to implement the
HasInfolists
interface but then you need to add:
custom page
but then you need to add:You don't if you follow the instructions. There's a trait which adds all the methods for you.
@Dennis Koch my bad I totally missed the traits. Now it works as expected. Thanks.