openplain/filament-tree-view
Drag-and-drop tree view for Filament resources to manage hierarchical data. Built on Laravel Adjacency List and Atlassian Pragmatic Drag & Drop. Supports depth limits, auto or batch save, custom fields, actions, dark mode, accessibility, and safe moves.
staudenmeir/laravel-adjacency-list, a battle-tested approach.Table, maintaining consistency with Filament’s API (e.g., tree(), fields(), actions()). Aligns with Filament’s component-based architecture.HasTreeStructure) and resource-specific configurations, enabling reuse across projects.parent_id and order columns (or customizable column names). No schema migrations provided—assumes existing tree structure or willingness to adapt.filament:assets, reducing manual configuration.laravel-adjacency-list (proven) and pragmatic-drag-and-drop (Atlassian-backed). No heavyweight dependencies.maxDepth() and lazy-loading (not explicitly documented but implied).descendants()) can hit database limits. Risk mitigated by maxDepth() and Laravel’s query caching.parent_id/order? Customize via getParentKeyName() and getOrderKeyName().table() with tree() in resource classes.TreePage and TreeRelationPage for dedicated tree views.EditAction, DeleteAction).parent_id, order). Works with:
// Pseudocode for migration
$nodes = Node::with('children')->get();
foreach ($nodes as $node) {
$node->parent_id = $node->parent?->id;
$node->order = $node->depth; // Or custom logic
$node->save();
}
HasTreeStructure trait to models (e.g., Category, Product).public function getParentKeyName(): string { return 'parent_node_id'; }
table() with tree() in Filament resources.ListRecords to TreePage or TreeRelationPage.// Before
public static function table(Table $table): Table { ... }
// After
public static function tree(Tree $tree): Tree {
return $tree->fields([TextField::make('name')]);
}
TextField, IconField). Extend via Fields\Field for domain-specific fields.Category) with basic tree functionality.maxDepth() and collapsible() for performance.laravel-adjacency-list for breaking changes.tree() method). Changes require code deployments..env or runtime toggles.// Example: Add validation to tree actions
Tree::make()->actions([
Action::make('reorder')
->requiresConfirmation()
->action(function (array $data) {
// Custom validation logic
if (invalid
How can I help you explore Laravel packages today?