LaravelPackages.net
Acme Inc.
Toggle sidebar
rapidwebltd/laravel-dynamic-menu

Laravel Dynamic Menu provides the foundation to build entirely dynamic database powered navigation menus for your web application.

258
5
v1.1.0
About rapidwebltd/laravel-dynamic-menu

rapidwebltd/laravel-dynamic-menu is a Laravel package for laravel dynamic menu provides the foundation to build entirely dynamic database powered navigation menus for your web application.. It currently has 5 GitHub stars and 258 downloads on Packagist (latest version v1.1.0). Install it with composer require rapidwebltd/laravel-dynamic-menu. Discover more Laravel packages by rapidwebltd or browse all Laravel packages to compare alternatives.

Last updated

📃 Laravel Dynamic Menu

This package provides the foundation to build entirely dynamic database powered navigation menus for your web application.

Requirements

This package requires:

  • PHP 7.0 or above
  • Laravel 5.5 through 13

Installation

You can install Laravel Dynamic Menu with Composer. Just run the following command.

composer require rapidwebltd/laravel-dynamic-menu

Setup

This package comes with various database migrations. To create the required tables, run the following Artisan command.

php artisan migrate

Laravel discovers the service provider automatically. The package retains its PHP 7.0 minimum while Composer selects a compatible framework version.

Adding menu items

Create a menu and add root or nested items with automatic sibling ordering.

$menu = new \RapidWeb\LaravelDynamicMenu\Models\Menu();
$menu->name = 'Main navigation';
$menu->save();

$home = $menu->add('Home', $homePage);
$menu->add('Contact', $contactPage);
$home->add('Overview', $overviewPage);

The optional final argument sets an explicit decimal display order. Items without a linked model are also supported and return an empty URL, which is useful for headings and nested groups.

$heading = $menu->add('Products');
$featured = $menu->add('Featured', $featuredPage, 0, 0.5);
Comments