Quick Start

This is a short guide meant to get you up and running quickly.

Creating a new menu

When adding a new menu you need to specify the menu name. This is the name that will be used to access the menu object in the future.

$menu = \Menu::getMenu('leftMenu');

Adding a drop down to the menu

To add a dop down just add a drop down method. The first parameter is the slug. The second is the text for the drop down. The third is a call back where you wil add your link methods.

$rightMenu->dropDown('user', \Auth::user()->username, function (DropDown $dropDown) {
    $dropDown->link('profile.edit', function (Link $link) {
        $link->name = 'Edit your profile';
        $link->url  = 'user/profile/';
    });
    $dropDown->link('logout', function (Link $link) {
        $link->name = 'Logout';
        $link->url  = route('logout');
    });
});

Accessing the menu from your view or controller

In your view or controller just you will need to call render

$menu = \Menu::render('leftMenu');

This will return your menu object. From there you can loop through the links and add the appropriate html.

@foreach ($menu->link as $link)
    <a href='{{$link->url}}'>{{$link->name}}</a>
@endforeach