Blueprint query by multiple fields

In the blueprint of a filter page, I want to query some project-pages using a specific filter.
The filter value is stored in a field called “filter” on those project-pages.
For example:

sections:
  pages:
    type: pages
    query: page.parent.childrenAndDrafts.filterBy('filter', page.uuid, ',')

This works perfectly.

But what if I want to query pages not only by the “filter” field, but by “filter” OR “type”?

The “type” field also contains additional filter values on those project-pages.

Something like this:

query: page.parent.childrenAndDrafts.filterBy('filter|type', page.uuid, ',')

How can I achieve this?

A custom pages method (or page model method) would be the way forward here. Inside your method, use filter() with a callable.

$pages->filter(fn($child) => $child->filter()->value() === 'xyz' || $child->type()->value() === 'xyz');

Thank yout! But how do I get the page.uuid into the method to filter?

By passing it as a parameter