Related Projects


My project pages contain filters to show them sorted on other pages.
At the end of each project page I want to show three random related projects.

Is it possible to commit that project tag to ->filterBy()?

Thanks so far.

Yes, sure, just pass the tag to filterBy():

$related = $page->siblings()->filterBy('tag', $page->tag())->shuffle()->limit(3);

You might have to use $page->tag()->value() if the above code does not work.

1 Like