novius/filament-relation-nested
Composer 安装命令:
composer require novius/filament-relation-nested
包简介
A filament package to manage relationships that use the NestedSet model.
README 文档
README
Introduction
This Laravel Filament package allows you to manage relation that uses the kalnoy/nestedset in your Laravel Filament admin panel.
Requirements
- PHP >= 8.2
- Laravel Filament >= 5
- Laravel Framework >= 11.0
Installation
composer require novius/filament-relation-nested
Publish Filament assets
php artisan filament:assets
Usage
Relation Manager
First create a RelationManager for your filament resource that have a relation to a model that uses nestedset package:
use Filament\Actions\CreateAction; use Filament\Actions\DeleteAction; use Filament\Actions\EditAction; use Filament\Tables\Columns\TextColumn; use Filament\Tables\Table; use Novius\FilamentRelationNested\Filament\Actions\FixTreeAction; use Novius\FilamentRelationNested\Filament\Resources\RelationManagers\TreeRelationManager; class MenuItemsTreeRelationManager extends TreeRelationManager { // Define the relationship name protected static string $relationship = 'items'; public function table(Table $table): Table { return $table ->columns([ TextColumn::make('title'), ]) ->pluralModelLabel('Menu items') ->recordTitleAttribute('title') ->headerActions([ CreateAction::make(), // Add the FixTreeAction if you want an action that fix the nestedset tree FixTreeAction::make(), ]) ->actions([ EditAction::make(), DeleteAction::make(), ]); } }
Then add it to your resource
class MenuResource extends Resource { public static function getRelations(): array { return [ // ... MenuItemsTreeRelationManager::class, ]; } }
TreeColumn
You can use this column in a filament table on a model that uses the nestedset package. This will display a column which, when sorting is this column, will give an idea of the tree.
use CodeWithDennis\FilamentSelectTree\SelectTree; use Exception; use Filament\Forms\Components\Checkbox; use Filament\Forms\Components\Grid; use Filament\Forms\Components\Hidden; use Filament\Forms\Components\Select; use Filament\Forms\Components\TextInput; use Filament\Forms\Form; use Filament\Forms\Get; use Filament\Forms\Set; use Filament\Resources\Resource; use Filament\Tables\Columns\TextColumn; use Filament\Tables\Table; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Novius\FilamentRelationNested\Filament\Tables\Columns\TreeColumn; use Novius\LaravelFilamentMenu\Enums\LinkType; use Novius\LaravelFilamentMenu\Facades\MenuManager; use Novius\LaravelFilamentMenu\Filament\Resources\MenuItemResource\Pages\CreateMenuItem; use Novius\LaravelFilamentMenu\Filament\Resources\MenuItemResource\Pages\EditMenuItem; use Novius\LaravelFilamentMenu\Filament\Resources\MenuItemResource\RelationManagers\MenuItemsRelationManager; use Novius\LaravelFilamentMenu\Models\Menu; use Novius\LaravelFilamentMenu\Models\MenuItem; use Novius\LaravelLinkable\Filament\Forms\Components\Linkable; use Wiebenieuwenhuis\FilamentCodeEditor\Components\CodeEditor; class MenuItemResource extends Resource { public static function table(Table $table): Table { return $table // This will disable the pagination when the table is sorted by the _lft field ->paginated(fn (Table $table) => ! empty($table->getSortColumn()) && $table->getSortColumn() !== '_lft') // This will default sort the table on the _lft field ->defaultSort('_lft') ->columns([ TreeColumn::make('_lft'), // .... ]); } }
Lint
Run php-cs with:
composer run-script lint
Contributing
Contributions are welcome! Leave an issue on Github, or create a Pull Request.
Licence
This package is under GNU Affero General Public License v3 or (at your option) any later version.
novius/filament-relation-nested 适用场景与选型建议
novius/filament-relation-nested 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 652 次下载、GitHub Stars 达 2, 最近一次更新时间为 2026 年 02 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「tree」 「nestedset」 「laravel」 「relation」 「nested」 「filament」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 novius/filament-relation-nested 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 novius/filament-relation-nested 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 novius/filament-relation-nested 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel 8 nested categories library
jsTree widget for yii2
An enhanced tree management module with tree node selection and manipulation using nested sets.
Doctrine2 behavior traits - slowhop fork
A fast and dynamic Merkle tree implementation
Create and manage taxonomy (terms) in Laravel App
统计信息
- 总下载量: 652
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 40
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0-or-later
- 更新时间: 2026-02-18