saintsystems/nova-resource-group-menu
Composer 安装命令:
composer require saintsystems/nova-resource-group-menu
包简介
Resource group sub-menus for Laravel Nova.
关键字:
README 文档
README
Give large resource groups their own menu pages with sub-groups.
Installation
You can install the package in to a Laravel app that uses Nova via composer:
composer require saintsystems/nova-resource-group-menu
Usage
To enable resource group menu pages add the DisplaysInResourceGroupMenu trait to your base Nova Resource.
// in your app/Nova/Resource.php class use SaintSystems\Nova\ResourceGroupMenu\DisplaysInResourceGroupMenu; abstract class Resource extends NovaResource { use DisplaysInResourceGroupMenu; //... Removed for brevity }
Then, within your Nova Resources that you want to group and place on their own resource group menu page, ensure the following:
- Set
$displayInNavigationtofalse:
// in your Nova Resource classes public static $displayInNavigation = false;
- Define a group for the resource:
// in your Nova Resource classes public static $group = 'Master Data';
- Define a sub-group for the resource:
// in your Nova Resource classes public static $subGroup = 'Vendors';
Finally, register the tool in your NovaServiceProvider like so:
use SaintSystems\Nova\ResourceGroupMenu\ResourceGroupMenu; /** * Get the tools that should be listed in the Nova sidebar. * * @return array */ public function tools() { return [ new ResourceGroupMenu ]; }
Optionally, define custom icons to use for each Resource Menu Group
/** * Get the tools that should be listed in the Nova sidebar. * * @return array */ public function tools() { return [ (new ResourceGroupMenu)->withMeta([ 'group_icons' => [ 'admin' => '<svg class="sidebar-icon" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="icon-shape"><path fill="var(--sidebar-icon)" d="M11,14.7324356 C11.5978014,14.3866262 12,13.7402824 12,13 C12,11.8954305 11.1045695,11 10,11 C8.8954305,11 8,11.8954305 8,13 C8,13.7402824 8.40219863,14.3866262 9,14.7324356 L9,17 L11,17 L11,14.7324356 Z M13,6 C13,4.34314575 11.6568542,3 10,3 C8.34314575,3 7,4.34314575 7,6 L7,8 L13,8 L13,6 Z M4,8 L4,6 C4,2.6862915 6.6862915,0 10,0 C13.3137085,0 16,2.6862915 16,6 L16,8 L17.0049107,8 C18.1067681,8 19,8.90195036 19,10.0085302 L19,17.9914698 C19,19.1007504 18.1073772,20 17.0049107,20 L2.99508929,20 C1.8932319,20 1,19.0980496 1,17.9914698 L1,10.0085302 C1,8.8992496 1.8926228,8 2.99508929,8 L4,8 Z" id="Combined-Shape"></path></g></g></svg>', 'master-data' => '<svg class="sidebar-icon" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="icon-shape"><path fill="var(--sidebar-icon)" d="M10,1 L20,7 L10,13 L0,7 L10,1 Z M16.6666667,11 L20,13 L10,19 L0,13 L3.33333333,11 L10,15 L16.6666667,11 Z" id="Combined-Shape"></path></g></g></svg>', 'reports' => '<svg class="sidebar-icon" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="icon-shape"><path fill="var(--sidebar-icon)" d="M19.9506248,11 C19.4489003,16.0533227 15.1853481,20 10,20 C4.4771525,20 0,15.5228475 0,10 C0,4.8146519 3.94667731,0.551099672 9,0.0493752426 L9,11 L19.9506248,11 L19.9506248,11 Z M19.8726884,8.4 C19.1906421,4.15869069 15.8413093,0.809357943 11.6,0.127311599 L11.6,8.4 L19.8726884,8.4 Z" id="Combined-Shape"></path></g></g></svg>', ], ]), ]; }
You can customize the subGroup card column width too, by setting the tool width:
/** * Get the tools that should be listed in the Nova sidebar. * * @return array */ public function tools() { return [ (new ResourceGroupMenu)->width('1/4'), ]; }
Credits
License
The MIT License (MIT). Please see License File for more information.
saintsystems/nova-resource-group-menu 适用场景与选型建议
saintsystems/nova-resource-group-menu 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 44k 次下载、GitHub Stars 达 27, 最近一次更新时间为 2019 年 03 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「nova」 「laravel」 「resources」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 saintsystems/nova-resource-group-menu 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 saintsystems/nova-resource-group-menu 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 saintsystems/nova-resource-group-menu 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Nova card that shows you your system information.
A Laravel Nova card.
A Laravel Nova package for publishable fields
Payment resources library used by the official CCV Payment Services plugins
A Laravel Nova package for translatable fields
Filament package to prevent the update of outdated records.
统计信息
- 总下载量: 44k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 27
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-03-21

