Most of the code has been rewritten, even though the public API remains backwards compatible.
SoftDeletes trait provides specific methods (forceDeleteTree(), restoreTree()).siblings() relation.graft(), graftOnto(), cut().withHeight() scope.All of these will be removed in the next major version:
--migrate option of the bonsai:grow command is deprecated.BelongsToOrderedTree trait is deprecated in favor of the combination of the BelongsToTree and Ordered traits.getTree() and getTreeDepth() methods are deprecated and will be replaced with something else in v4.deleteNode() method is deprecated because it didn't seem very useful.withAncestors() and withDescendants() scopes are deprecated in favor of just using the with() method.whereIsRoot() becomes onlyRoots(),whereIsLeaf() becomes onlyLeaves(),whereHasChildren() becomes hasChildren(),whereIsDescendantOf() becomes descendantsOf(),whereIsAncestorOf() becomes ancestorsOf(),includingSelf() becomes withSelf(),excludingSelf() becomes withoutSelf(),upToDepth() becomes maxDepth(),getSubtreeDepth() becomes getHeight().bonsai:grow now works with any type of key (such as UUIDs). It used to assume that the id column was an integer.withSelf()) can now be called in the constraints callback
when using withCount() or whereHas().deleteTree()Added Laravel 11 support (issue #3).
getTree() method, when called on an ordered tree, now orders the root elements (issue #1).Added Laravel 10 support.
Added Laravel 9 support.
bonsai:fix command.parent relationship is now properly auto-loaded when with('ancestors') is used. Previously, it would be loaded with wrong parents if the ancestors relationship was not ordered by ascending depth, or was filtered by some constraint.Laravel 8 support.
deleteNode method.whereIsDescendantOf / whereIsAncestorOf now accept a Model as parameter.deleteTree implementation to avoid errors on bigger trees.How can I help you explore Laravel packages today?