11# Welcome to Laravel Menu!
22
3- Generate multi navigation menus with unique names, can be displayed anywhere. Custom templating. Support Laravel 5.
3+ Generate multi navigation menus with unique names, can be displayed anywhere. Custom templating. Support Laravel 5, 6, 7.
4+
5+ ![ Alt image] ( screenshoot.png )
46
57------
68
@@ -52,21 +54,35 @@ You can create in the routes files, middleware, or service providers that you cu
5254``` php
5355<?php
5456
55- Menu::make('sidebar', function () {
56- Menu::link('Dashboard', route('home'), 'view-dashboard');
57-
58- Menu::dropdown('Users', function () {
59- Menu::link('All', 'users');
60- Menu::link('Add New User', 'users/create');
61- }, 'accounts');
62-
63- Menu::link('Posts', 'posts', 'paper');
64-
65- Menu::dropdown('Settings', function () {
66- Menu::link('Date and Time', 'settings/date-time');
67- Menu::link('Other Setting', 'settings/other');
68- }, 'wrench');
57+ Menu::make('sidebar', function ($menu) {
58+ Menu::link('Home', 'home')->setIcon('fas fa-home');
59+ Menu::link('Article', 'articles')->setIcon('fas fa-newspaper')
60+ ->setData([
61+ 'badge' => [
62+ 'type' => 'warning',
63+ 'text' => '16'
64+ ]
65+ ]);
66+
67+ Menu::link('Comment', 'comments')->setIcon('fas fa-comments')
68+ ->setData([
69+ 'badge' => [
70+ 'type' => 'primary',
71+ 'text' => 'New'
72+ ]
73+ ]);
74+
75+ Menu::dropdown('Services', function () {
76+ Menu::link('Service 1', 'services/one');
77+ Menu::link('Service 2', 'services/two');
78+ });
79+
80+ Menu::heading('Account');
81+
82+ Menu::link('Change Password')->setIcon('fas fa-key');
83+ Menu::logout()->setIcon('fas fa-sign-out-alt');
6984});
85+
7086```
7187
7288
@@ -78,7 +94,7 @@ Menu::make('account', function () {
7894
7995 Menu::separate();
8096
81- Menu::link('Change Password', url('change-password'), 'view-dashboard');
97+ Menu::link('Change Password', url('change-password'), 'view-dashboard');
8298 Menu::logout();
8399
84100 // Alternative to
@@ -88,6 +104,12 @@ Menu::make('account', function () {
88104
89105
90106
107+ #### Set View
108+
109+ ``` php
110+ Menu::get('sidebar')->setView('admin-lte');
111+ ```
112+
91113
92114#### Render to View
93115
@@ -119,6 +141,18 @@ To be able to customize the navigation with view
119141Menu::get('sidebar')->setView('view.name');
120142```
121143
144+ Available default views:
145+
146+ ``` php
147+ 'views' => [
148+ 'simple' => 'menus::simple.menu',
149+ 'bs-nav-stacked' => 'menus::bs-nav-stacked.menu',
150+ 'sbadmin2' => 'menus::sbadmin2.menu',
151+ 'adminto' => 'adminto::menus.sidebar.menu',
152+ 'admin-lte' => 'menus::admin-lte.menus',
153+ ]
154+ ```
155+
122156Then you can customize ` view.name ` and receive ` $menu ` variable ` Nurmanhabib\Navigator\NavCollection `
123157
124158``` html
@@ -159,12 +193,12 @@ Then you can customize `view.name` and receive `$menu` variable `Nurmanhabib\Nav
159193```
160194
161195
162- ## Custom Render
196+ ## Custom Renderer
163197
164198``` php
165199use Nurmanhabib\LaravelMenu\Renders\NavViewRender;
166200
167- Menu::get('sidebar')->setRender (new NavViewRender('view.name'));
201+ Menu::get('sidebar')->setRenderer (new NavViewRender('view.name'));
168202```
169203
170204------
@@ -196,3 +230,7 @@ $collection->addParent('Text Parent', callback($child), 'icon', '#');
196230$collection->add($nav);
197231$collection->getItems();
198232```
233+
234+ ## Contributing
235+
236+ I apologize if the documentation is still not perfect, if you are willing to contribute to the documentation please do a Pull Request. We also feel happy if we want to contribute to open source.
0 commit comments