adding table filter in action->url()

On a ViewRecord page, I have an action button to open url to another resouce's ListRecord page but with a particular table filter preset. I did like the following:
Action::make('orders')
->url(function(Customer $record){
return OrderResource::getUrl('index', [
'tableFilters[customer_id][value]' => $record->id
]);
})
->label('Your Orders')
->openUrlInNewTab(),
Action::make('orders')
->url(function(Customer $record){
return OrderResource::getUrl('index', [
'tableFilters[customer_id][value]' => $record->id
]);
})
->label('Your Orders')
->openUrlInNewTab(),
. It works. Is there a better or proper way to achieve it? Thanks.
1 Reply
sweetplum
sweetplumOP14mo ago
it works and the filter is showing as an active filter so users can remove it. Is it possible to set the filter but invisible to users? I think I want the action->url() to this new list records page with a preset filter programmatically.

Did you find this page helpful?