$pages->map($callback)

Returns a new collection and applies the mapping callback to all pages

  • $callback (function)
    The function to be applied to all pages in the collection
  • return ($pages)

Example

function changeDate($page)  {
  if($page->year() == '2015') {
    $page->update(array(
    'year' => '2016',
  ));
  }
}
page('projects')->children()->map('changeDate');