Get the page uuid

I am trying to populate a pages field from a CSV file using the page title.

I can get the page slug like this:

 $species = $tree['Species'];
 $speciesPage = site()->find('species')->filterBy('template', 'species')->filterBy('title', $species)->first();

but the page fields now stores the uuid. I thought I might be able to do this:


but nothing returns

That code doesn’t make sense, you probably mean

site()->find('species')->children()->filterBy('template', 'species')`

Or what are you trying to filter here?

I am trying to find the matching page using the page title as I need to use something that makes sense in the csv file.

Well, yes, but you can only filter a collection, and you are trying to filter a single page.

Ah right, yes sorry - looping through the children works.

          $speciesPage = site()->find('species')->children();

          foreach ($speciesPage as $sp) {
            if ($sp->title() == $species) {
              $speciesPage = $sp->uuid();
              $speciesPage = (string)$speciesPage;