Select all pages AND children filtered by a category


I’m trying to display a random page by selecting a category with something like that:

$allPages = $site->pages()->listed()->filterBy( "categories", $cat, "," );
$theOne = $allPages->shuffle()->first();

But, in my pages structure I have Events->Artists->Pieces.

And what I’m trying to have is a random event, artist or piece depending on the cat, but if I do $site->pages() or $site->children(), I only select events, what is quite logical.

Now, How can I select all pages and their children, and there children ?

I don’t understand your case completely, but this might help:

Is there a single parent to the pages you want to fetch?

That’s it, thank you very much !