Skip to content

Instantly share code, notes, and snippets.

Created April 16, 2014 23:49
Show Gist options
  • Save anonymous/10942979 to your computer and use it in GitHub Desktop.
Save anonymous/10942979 to your computer and use it in GitHub Desktop.
Menu without comments
<?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;
}
}
@gplv2
Copy link

gplv2 commented Aug 14, 2014

You have a typo in this file:

     $sub2->push((object)['type' => 'divider']);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment