Skip to content

Instantly share code, notes, and snippets.

@mishbah
Forked from anonymous/gist:10942979
Created July 16, 2014 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mishbah/fd1e41afbfb4bedb2ce7 to your computer and use it in GitHub Desktop.
Save mishbah/fd1e41afbfb4bedb2ce7 to your computer and use it in GitHub Desktop.
<?php
use Illuminate\Support\Collection;
use Illuminate\View\View;
class Navigation {
public function compose(View $view) {
$menu = new Collection;
$menu->push((object)['title' => 'Home', 'link' => URL::to('/')]);
$sub1 = new Collection;
$sub1->push((object)['title' => 'About me', 'link' => URL::route('about.me')]);
$sub1->push((object)['title' => 'About the site', 'link' => URL::route('about.site')]);
$menu->push((object)['title' => 'About', 'menu' => $sub1, 'type' => 'menu']);
$menu->push((object)['title' => 'Blog', 'link' => URL::route('blog.home')]);
$menu->push((object)['title' => 'Gallery', 'link' => URL::route('gallery.home')]);
$sub2 = new Collection;
$sub2->push((object)['title' => 'Some links I find awesome', 'type' => 'heading']);
$sub2->push((object)['title' => 'RTFM', 'link' => 'http://matthewhailwood.co.nz']);
$sub2->push((object)['title' => 'Google', 'link' => 'http://google.com']);
$sub2->push((object)['type' => 'divider');
$sub2->push((object)['title' => 'Blog post 32', 'link' => URL::route('blog.post', 32)]);
$menu->push((object)['title' => 'Links', 'menu' => $sub2, 'type' => 'menu']);
$view->menu = $menu;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment