- How do I install this package for Laravel Filament v4 or v5?
- Run `composer require solution-forest/filament-nestable-tree` and ensure your Filament theme includes the package’s Blade views by adding `@source '../../../../vendor/solution-forest/filament-nestable-tree/resources/**/*.blade.php'` to your custom theme CSS file. Follow Filament’s theming guide if needed.
- Does this work with Eloquent models that aren’t using kalnoy/nestedset?
- The package works best with `kalnoy/nestedset`, but you can adapt it for other hierarchy strategies (e.g., materialized path) by implementing custom backend logic for reordering and validation. The frontend UI remains the same.
- Can I use this for multi-tree pages (e.g., separate trees for different categories)?
- Yes, the package supports multi-tree pages out of the box. You can configure multiple trees on a single Filament page, and it even allows cross-tree drag-and-drop between them.
- What Laravel and Filament versions are supported?
- This package supports Laravel 10.x/11.x and Filament v4/v5. Always check the [GitHub repo](https://github.com/solutionforest/filament-nestable-tree) for the latest compatibility updates, as Filament v5 may introduce breaking changes.
- How does lazy loading work, and when should I use it?
- Lazy loading defers child node requests until a node is expanded, improving performance for large trees. Enable it via the `lazyLoad` option in your tree configuration. Use it for deep or wide hierarchies to avoid loading unnecessary data upfront.
- Can I add custom actions (e.g., delete, edit) to individual tree nodes?
- Yes, the package supports per-node actions via the `actions` configuration option. You can define buttons, dropdowns, or modals for each node type, and they’ll appear inline with the tree.
- What if JavaScript fails? Is there a fallback for users without JS?
- The package relies on JavaScript for drag-and-drop, but you can implement a text-based tree fallback by extending the package’s Blade templates or using Filament’s built-in table/list views for static hierarchies.
- How do I handle concurrent drag-and-drop operations from multiple users?
- Concurrent operations can lead to race conditions. Implement server-side validation (e.g., check `parent_id` permissions) and consider using database transactions or optimistic locking for critical reordering operations.
- Is this package suitable for non-Filament Laravel apps?
- No, this package is tightly coupled to Filament. While you could extract the frontend logic, the backend integration assumes Filament’s resource/CRUD patterns. For non-Filament apps, consider alternatives like `filament-tree` or custom solutions.
- What’s the best way to test this package in my application?
- Start with the [demo application](https://filament-cms-website-demo.solutionforest.net/admin) or the [fixture pages](tests/fixtures/Pages) in the repo. Test drag-and-drop, lazy loading, and per-node actions in a staging environment before deploying to production. Use Filament’s built-in testing tools for assertions.