Policy depends on request path

Hello All,

I have the following problem:
I have a [event] resource and the resource view page have a couple of relations (eg. attendees, vendors, etc).

I want to add policies to these relations, but to determine if the given user has access to an operation I need the event id {record}.

I tried to reach the request route parameter (request()->route()->parameter('record');), it works, but when I change tab, the livewire call (livewire/update) behind the scene refresh the data and the given operation will be refused due to the livewire call does not have the {record} parameter in the url .

As a workaround I thought to save the event_id to a session variable, but this will cause a problem when a user have multiple browser window with different event to view.

Question how can I reach an URL parameter and make it available for the subsequent livewire calls?
Was this page helpful?