I am trying to set up pages that contain two dates: “From” and “To” and would like to filter pages out, if the current date isn’t between from and to.
I assumed, this could be done with:
$items = $page->children()->filterBy('date', '>', time());
but it seems, this only works with one field, and its name has to be “date”.
What i like to have is this:
$items = $page->children()->filterBy('from', '<', time())-> filterBy('to', '>', time());
but this doesn’t work, as far as i know.
Do you have an idea for an elegant solution?
I think this could make sense, when you have a list of subpages and want to divide it into current and past items.
I looked into these threads:
but couldn’t find a solution.
Thanks,
Matthias