$pages->prepend($key, $object)

Prepends an element to the data array

  • $key (string)
  • $object (mixed)
  • return (collection)

Example

<?php
    $collection = page('projects')->children()->limit(1);
    foreach(page('projects')->children()->offset(1) as $key => $child) {
      $collection->prepend($key, $child);
    }
    foreach($collection as $item) {
      echo $item->title() ;
    }
?>