/**
  * Walk thru the pages tree and return the navigation html and set currentPage is found
  *
  * WARNING: DEPRECIATED!!! WILL BE REMOVED IN 1.0 RELEASE!
  * Should be done in your Page model, See Page.php in samples
  */
 function walk($parent, $depth, $ids, $url = '', $hidden = false)
 {
     # The id might not exist if it's the domain root for example
     if (!isset($ids[$depth])) {
         $ids[$depth] = '';
     }
     # Fetch all pages
     $pages = \App\Page::parent($parent)->get();
     # Return if no pages found to prevent empty navigation <ul></ul>
     if (!count($pages)) {
         return;
     }
     # Create the navigation html
     $nav = '<ul class="nav' . $depth . '">';
     foreach ($pages as $page) {
         # Set currentPage if it's this one but only if $depth equals the actual amount of ids
         if ($ids[$depth] == $page->url && $depth == count($ids) - 1) {
             $this->currentPage = $page;
         }
         # Add page to navigation html and add active class when needed
         if (!$page->hidden) {
             $nav .= ' <li' . ($ids[$depth] == $page->url ? ' class="active"' : '') . '>';
             $nav .= '<a href="' . $url . $page->url . '">' . $page->title . '</a>';
         }
         # Check if this page has subpages and add them
         $nav .= $this->walk($page->id, $depth + 1, $ids, $url . $page->url . '/', $page->hidden || $hidden);
         # Finalize navigation html
         if (!$page->hidden) {
             $nav .= '</li>';
         }
     }
     # Finalize navigation html and return it
     $nav .= '</ul>';
     if (!$hidden) {
         return $nav;
     }
 }