solutionforest / filament-tree

Filament Tree is a plugin for Filament Admin that creates a model management page with a heritage tree structure view. This plugin can be used to create menus and more.
MIT License
125 stars 43 forks source link

Fix - Allow to override tree parent key in the model #8

Closed skoro closed 1 year ago

skoro commented 1 year ago

This PR fixes a case when the model needs to use a parent key which is differ from the defined global one and the model sets it via defaultParentKey static method. Use case: by default the parent key is -1, the model sets it to 0. Without this PR after saving the tree all the parent nodes would have -1 as a parent key. The PR fixes that and all the saved nodes would have 0 as it needed.