- How do I install novius/filament-relation-nested in a Laravel 11 + Filament 5 project?
- Run `composer require novius/filament-relation-nested` and publish Filament assets with `php artisan filament:assets`. Ensure your project meets the requirements: PHP 8.2+, Laravel 11+, and Filament 5+. No additional migrations are needed if you already use `kalnoy/nestedset`.
- Can this package handle deeply nested hierarchies (e.g., 10+ levels) without performance issues?
- The package relies on `kalnoy/nestedset`, which uses `_lft`/`_rgt` columns for efficient tree queries. For very deep hierarchies, test query performance under load, as large trees may impact indexing or UI rendering speed. Consider pagination or lazy-loading for deep structures.
- What happens if the nested set structure gets corrupted? Does FixTreeAction fully restore it?
- The `FixTreeAction` recalculates the `_lft`/`_rgt` values to repair the tree structure. It works for most corruption cases, but test it on a backup first. For severe corruption, manual intervention or a database reset may be needed. Always back up your database before running FixTree.
- Is novius/filament-relation-nested compatible with Filament 6 when it releases?
- The package is currently locked to Filament 5. If Filament 6 introduces breaking changes to RelationManagers or Actions, this package may require updates or forks. Monitor the GitHub repo for compatibility announcements or be prepared to fork and maintain it yourself.
- How do I customize the TreeColumn to show indentation or icons for nested items?
- Extend the `TreeColumn` class or override its methods in your `TreeRelationManager`. Use the `indentation` and `icon` parameters in the column definition, or subclass `TreeColumn` to add custom logic. Example: `TreeColumn::make('title')->indentation(true)->icon('heroicon-o-chevron-right').`
- Does this package support concurrent edits to the same tree by multiple users?
- The package does not include built-in locking mechanisms. Concurrent edits can lead to race conditions when rebalancing the tree. Implement application-level locking (e.g., database transactions or optimistic locking) if multiple users frequently edit the same hierarchy.
- What alternatives exist for managing nested sets in Filament if this package isn’t suitable?
- Consider building a custom `RelationManager` with `kalnoy/nestedset` queries or using packages like `spatie/laravel-activitylog` for simpler hierarchies. For non-Filament projects, libraries like `cubex/closure-table` or `ocramius/package-versions` (for dependency trees) may fit better.
- How do I test if the tree structure remains valid after bulk operations (e.g., drag-and-drop reordering)?
- Use the `FixTreeAction` in tests to validate the structure post-operation. Alternatively, write unit tests with `kalnoy/nestedset`'s `rebuild()` method or assert `_lft`/`_rgt` values programmatically. Test edge cases like circular references or orphaned nodes with seeded data.
- Will this package work with Laravel’s first-party models (e.g., `Category` with nestedset) or only custom models?
- The package works with any Eloquent model using `kalnoy/nestedset`, including Laravel’s first-party models like `Category`. Ensure the model has the `_lft`/`_rgt` columns and the `reorder()`/`rebuild()` methods from `NestedSet` are available. No additional setup is required beyond the standard NestedSet implementation.
- Does the AGPL license restrict commercial use of this package?
- Yes, the AGPL license requires you to open-source your entire project if you use this package commercially. Review the license carefully and consult legal counsel to ensure compliance with your project’s requirements. Alternatives like custom implementations may avoid licensing issues.