The Menus are lists of links that appear on your application.

Registering menus allow for creating easily customizable menus areas, which can be managed inside Appearance > Menus administration panel.

Basics of menus

All application menus should be defined inside app\Support\menus.php file. This file is included on application bootstrap by the App\Providers\AppServiceProvider class.

Creating menu

Registering menus are really simple. All you have to do is to call create method on Menu facade.


Create method accepts options as the second argument.

Menu::create('primary', [
    'title' => ['Main menu'],

List of available options:

Option name Default value Description
title [] Menu title displayed in the admin

Getting menu

Calling get method will return previously registered menu instance.


Checking if menu is in use

You can check if menu contains any items with isActive method.

    // have items

Rendering menu in templates

Grab all menu items with items method. This will return a collection of Assely\Adapter\Menu instances.

<!-- resources/views/index.blade.php -->

<div class="menu--primary">
    @include('menu.nav', [
        'items' => Menu::get('primary')->items()

Now, you only need to loop through items in a @foreach statement.

<!-- resources/views/menu/nav.blade.php -->

    @foreach($items as $item)
            <a href="{{ $item->link }}">{{ $item->title }}</a>

            If menu item have children items,
            recursively include this view.
                @include('menu.nav', [
                    'items' => $item->children()