fnematov/nova-nested-tree
Composer 安装命令:
composer require fnematov/nova-nested-tree
包简介
Nova vue-tree-select field for management nested category relations.
README 文档
README
Support Laravel nova 4. for nova 3 , use this package.
Suppot:
Belongs To Many Field for simple manage Nested relation tree. Enables attaching relationships easily.
RoadMap
- Validation
- Show selected categories on Detail
- Ability to pass your own tree
- Ability to
Delayed Loadingdata when tree has many records ( example 10k+ ).
Installation
composer require fnematov/nova-nested-tree
Usage
This field uses tree provided by kalnoy/nestedset package
This field uses riophae/vue-treeselect under the hood
use Fnematov\NovaNestedTree\NestedTreeAttachManyField;
public function fields(Request $request) { return [ NestedTreeAttachManyField::make('Offer Categories',"categories","App\Nova\Category"), ]; }
Your model should has NodeTrait form package kalnoy/nestedset see RoadMap
class Category extends Model { use NodeTrait; }
Options
Here are a few customization options
->searchable(bool $searchable)->withIdKey(string $idKey = 'id')// - id column name in your nested model->withLabelKey(string $labelKey = 'name')// - label column name in your nested model->withActiveKey(string $activeKey)// - active_status column name in your nested model used for disable options->withChildrenKey(string $childrenKey)// - children key in your nested model->withPlaceholder(string $placeholder)// - placeholder in tree select->withMaxHeight(int $maxHeight)->withSortValueBy(string $sortBy)// - @see https://vue-treeselect.js.org/#flat-mode-and-sort-values->withAlwaysOpen(bool $alwaysOpen)// - by default select is open, but you can change it behavior->withFlatten(bool $flatten)// - by default flatten is enabled, but you can change it behavior->useSingleSelect()// - ability for select only one value->useAsField()// - ability to write result to field without relations
Example of use with package whitecube/nova-flexible-content
use Whitecube\NovaFlexibleContent\Flexible; use Fnematov\NovaNestedTree\NestedTreeAttachManyField; /** * Get the fields displayed by the resource. * * @param \Illuminate\Http\Request $request * @return array */ public function fields(Request $request) { return [ // ... Flexible::make('Content') ->addLayout('Simple content section', 'tree_section', [ NestedTreeAttachManyField::make('Tree',"tree","App\Nova\Category") ->useAsField(), ]) ]; }
Authorization
This field also respects policies: ie Role / Permission
- RolePolicy: attachAnyPermission($user, $role)
- RolePolicy: attachPermission($user, $role, $permission)
- PermissionPolicy: viewAny($user)
Validation
You can set min, max, size, required or custom rule objects
->rules('min:5', 'max:10', 'size:10', 'required', new CustomRule)`
Contributing
Feel free to suggest changes, ask for new features or fix bugs yourself.
Hope this package will be useful for you.
credit
fnematov/nova-nested-tree 适用场景与选型建议
fnematov/nova-nested-tree 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 09 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「nova」 「laravel」 「nested-sets」 「belongs-to-many」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 fnematov/nova-nested-tree 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fnematov/nova-nested-tree 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 fnematov/nova-nested-tree 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Nova card that shows you your system information.
Nova vue-tree-select field for management nested category relations.
A Laravel Nova card.
jsTree widget for yii2
Package
A Laravel Nova package for publishable fields
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-11
