By creating any project, we face the problem of creating a menu.
Often, we need a simple menu that can be updated at the DB layer, because of that I created a very simple package for Laravel.
This package is customized for bootstrap 4.*, but you can change the view for other or custom css libraries.
Install
composer require begicf/simple-menu
Register Service Provider
Go in 'config/app.php' file.
Find array providers and add this element to register provider:
\SimpleMenu\SimpleMenuServiceProvider::class
Migrate
php artisan migrate
SQL Menu table
Name | Type |
---|---|
id | int |
parent_id | int |
title | varchar (255) |
description | varchar (255) |
order | int |
created_at | timestamp |
update_at | timestamp |
How to use
Put in view blade template
<x-menu-menu-component />
Publish resources
php artisan vendor:publish --provider="SimpleMenu\SimpleMenuServiceProvider"
Example
<ul class="navbar-nav mr-auto">
<x-menu-menu-component />
</ul>
Top comments (1)
Hi, does it work with laravel 8?