Structure FindBy() partial data

Hi, I’m interested if it’s possible to find something in a structure not by the complete value?

In a structure I have a title “BOM (v1.0)”, (the version number differs on every page), so I just want to look for BOM but currently $page->resources()->toStructure->findBy(“title”, “BOM”) doesn’t return anything. Then the next field is an url and I’d want to get the url of the row that has the name “BOM” in it. If this is not the solution, what should I look for?

You can use filterBy in this case.

$item = $page->resources()->toStructure->filterBy('title', '^=', 'BOM')->first();

Since filterBy() returns a collection, to get a single item you need to use first().

Fantastic, thanks a lot!