I want to filter a page collection inside a route. My code:
[
'pattern' => 'categories/(:alpha)/filter',
'action' => function($category) {
$items = page('items')->children()->listed()->filterBy('category', $category);
]
page('items')->children()->listed()
returns the pages I want, but the filtering by the ‘category’ field is not happening. How can I solve this?