Warp Tree demo — trees of departments and categories for Filament: choose, filter, edit by dragging. Change or delete anything; the data is reset every hour. warpui.com About Warp Tree Docs Ask a question Support
Skip to content

Switching from Select Tree

Already using codewithdennis/filament-select-tree? Change one use line to Qalainau\FilamentWarpTree\Forms\Compat\SelectTree and keep your code: the same methods, arguments and defaults. The tree is then read a branch at a time. Press “View code” to see the fields below.

The same code

->relationship('department', 'name', 'parent_id'), with the parent column as the third argument. As in Select Tree, a single select chooses only the lowest level.

Note: Try it

Click Sales: it opens instead of being chosen. Open East › Boston and choose Field sales.

enableBranchNode()

The same method as in Select Tree: departments that have departments under them can be chosen too.

Note: Try it

Choose East: it is chosen, not opened.

query(), independent(false) and withCount()

->query(fn () => Department::query(), 'name', 'parent_id') builds the tree without a relationship, as in Select Tree. ->independent(false) ticks the lowest departments under a department, and ->withCount() shows how many items each department has.

Note: Try it

Open Sales and tick Canada. The four city offices under it are not chosen, only their teams: press “Show what would be saved” to see 12 departments.