I have a list of seminars in a structure field. Each seminar is referenced with a trainer page via a pages field.
On the trainer page I list his/her seminars. Works fine like this:
<?php
$title = $page->title();
$items = $site->seminars()->toStructure()
->filter(function ($child) use($title) { return $child->trainer()->toPage()->title() == $title; });
foreach ($items as $item):
?>
But it turned out a seminar can have multiple trainers, ergo the seminar must appear on all referenced trainer pages.
How can I check if the $title appears in multiple pages ($child->trainer()->toPages())?
I have a feeling this is probably not the most elegant solution anyways
THANKS!