-
-
Save mishbah/fd1e41afbfb4bedb2ce7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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