therour / menu-directive
使用blade指令创建菜单
v1.0.1
2020-03-21 19:44 UTC
Requires
- php: ^7.1.13
- illuminate/console: 5.8.*|^6.0|^7.0
- illuminate/http: 5.8.*|^6.0|^7.0
- illuminate/support: 5.8.*|^6.0|^7.0
This package is auto-updated.
Last update: 2024-09-22 05:09:50 UTC
README
使用blade指令创建导航菜单
安装
只需通过composer安装该包
composer require therour/menu-directive
配置
- 发布配置文件
php artisan vendor:publish --provider="Therour\MenuDirective\MenuDirectiveServiceProvider"
- 您可以在
config/menu-directive.php
文件中用自己的类替换构建器,以匹配您的UI。示例构建器在默认配置中定义。
'builder' => Therour\MenuDirective\BootstrapMenuBuilder::class,
创建菜单构建器
-- 进行中 --
创建菜单
@sidebarHeading('Heading 1') // output Heading 1 @sidebarMenu([ // Create Menu 'title' => 'Application', 'icon' => 'fas fa-fw fa-cubes', 'url' => '#', // 'active' => '/' // define your url pattern to match for giving active class // by default is current url == menu's url will set the menu's class active. ]) @sidebarDropdown([ // Create Dropdown menu 'title' => 'Dropdowns', 'icon' => 'fas fa-fw fa-cubes', 'active' => '/dropdowns/*' // same as menu's active url pattern ], function ($dropdown) { $dropdown->heading('Heading:'); // add heading inside dropdown $dropdown->menu(['title' => 'Sub Menu 1', 'url' => url('dropdowns/1')]); $dropdown->menu(['title' => 'Sub Menu 2', 'url' => url('dropdowns/2')]); $dropdown->menu(['title' => 'Sub Menu 3', 'url' => url('dropdowns/3')]); $dropdown->menu(['title' => 'Sub Menu 4', 'url' => url('dropdowns/4')]); } )