承接 jminayat/laravel-menu 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jminayat/laravel-menu

Composer 安装命令:

composer require jminayat/laravel-menu

包简介

Menu management for Laravel

README 文档

README

jminayat/modules-laravel is a package for the administration of menus in laravel. compatible with Laravel version 5.5.

Installation

Install the package through the composer.

composer require jminayat/laravel-menu

Next, publish the package configuration file by running:

php artisan vendor:publish --provider="JMinayaT\Menus\MenusServiceProvider"

Creating a menu

For the creation of a menu, call the creation method from Menu facade. The first parameter is the name of the menu and the second parameter is the callback to define the menu items.

Menu::create('test',function($menu){
    $menu->link('home/1','Home',['icon'=>'icon-home']);
});

Make Multiple Menus

If you want to create multiple menus

Menu::create('test1',function($menu){
    $menu->link('home/1','Home',['icon'=>'icon-home']);
});

Menu::create('test2',function($menu){
    $menu->link('user','user');
});

Menu items

Menu Link

To create a link menu item use $menu->link()

Menu::create('test',function($menu){
    //           'url'   'title'     'attributes'
    $menu->link('home/1','Home',['icon'=>'icon-home']);
});

Menu Route

If you have a rute element defined with your name, use $menu->route()

Menu::create('test',function($menu){
    //           'name rute'  'title'  'route parameters'    'attributes'
    $menu->route('cars.show', 'Cars', ['name'=>'toyota'], ['icon'=>'icon-car']);
});

Menu Dropdown

to create a dropdown menu item use $menu->dropdown()

Menu::create('test',function($menu){
    //             'title'    'attributes'          'callback '
    $menu->dropdown('test',['icon'=>'icon-test'], function($item){
            $item->link('/test','test1',['icon'=>'fa-fa-icon']);
            $item->link('/test','test2',['icon'=>'fa-fa-icon']);
            $item->link('/test','test3');
    });
});

Menu Dropdown Multi Level

To create a drop-down menu within another drop-down menu use $item->dropdown()

Menu::create('test',function($menu){
    //             'title'    'attributes'          'callback '
    $menu->dropdown('test',['icon'=>'icon-test'], function($item){
            $item->link('/test','test1');
            
            $item->dropdown('test',['icon'=>'icon-test'], function($item){
                $item->link('/test','test2');
            });
    });
});

Order Menu Items

You can sort the menu items in two ways, by the order number or alphabetically.

By default in the configuration file the ordering is deactivated, you can activate it directly in the configuration file or use the method $menu->activeOrder().

Menu::create('test',function($menu){
    $menu->activeOrder();
});

To set the value of the order call the method ->order().

Menu::create('test',function($menu){
    $menu->activeOrder(); //active order
    $menu->link('home/1','Home',['icon'=>'icon-home'])->order(1);
    $menu->link('contact','Contact',['icon'=>'icon-contact'])->order(3);
    $menu->link('pages','Pages',)->order(2);
});

To order alphabetically use the method $menu->setOrderBy($type).

Menu::create('test',function($menu){
    $menu->activeOrder();// active order
    $menu->setOrderBy('title'); // 'title' or 'number'
});

By default, the orden function is disabled. You can enable the order function in your configuration file.

return [
	'ordered' => true
];

And the type of order, by default is order by number.

return [
	'orderBy' => 'title'
];

Rendering menu

To render the menu you can use show or get method.

Menu::get('test');

Menu::show('test');

Edit menu

To edit a menu already created use the edit method of the facade Menu.

Menu::edit('test',function($menu){
    $menu->link('home/1','Home',['icon'=>'icon-home']); // add link item
});

To edit an item in a menu.

Menu::edit('test',function($menu){
    //            'search parameter'   'name'
    $menuItem = $menu->edit('title', 'test');
    $menuItem->title = 'hola';
});

To edit elements of a dropdown.

Menu::edit('test',function($menu){
    //            'search parameter'   'name'
    $menuItem = $menu->edit('title', 'test'); //dropdown item
    $menuItem->link('/test2','testt2',['icon'=>'fa-fa-icon']); //add dropdown item
    //                   'search parameter'   'name'
    $subMenuItem = $menuItem->edit('title', 'test1'); //edit dorpdown item
    $subMenuItem->title = 'test3';
});

Configuration

to publish the package configuration use the following command

php artisan vendor:publish --provider="JMinayaT\Menus\MenusServiceProvider"

The content of the configuration file is as follows:

return [

    'aspect' => [
        
      'MtsysAdmin'  => 'JMinayaT\Menus\Aspects\MtsysAdmin\SidebarMenuAspect',
    ],

    'default_aspect' => 'MtsysAdmin',

    'ordered'   =>    false,

    'orderBy'   =>    'number',

];

aspect

These are available ready to use menu aspects.

default_aspect

set the default aspect.

ordered

Enable or disable menu item ordering for all menus.

orderBy

Set the default order type in alphabet or number.

License

The MIT License (MIT). Please see License File for more information.

jminayat/laravel-menu 适用场景与选型建议

jminayat/laravel-menu 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 20 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「menu」 「laravel」 「menus」 「jminayat」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 jminayat/laravel-menu 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 jminayat/laravel-menu 我们能提供哪些服务?
定制开发 / 二次开发

基于 jminayat/laravel-menu 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 20
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-01-04