Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

gdavid's avatar

Apply default filter only on resource view

I have a "shipments" resource.

when viewing this resource i want to see only those who were not picked up yet by the postman. so i used default value for this filter.

 public function default()
     {
         return 'ready';
     } 

"Customers" resource "has" somtimes "shipments", When i view customers, i want to see all shipments including those who were picked up by the postman.

But the default filter is filtering also at customer view.

How can i apply the default filter only when viewing the "shipments" resource ?

0 likes
1 reply
devfrey's avatar

I don't know the full answer from the top of my head, but you could try looking at the request's query and route parameters. That should help you differentiate which resource the user is looking at.

Please or to participate in this conversation.