Hello,
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 ?