Skip to content

v4.1.0

Latest
Compare
Choose a tag to compare
@lazychaser lazychaser released this 02 Mar 07:58
· 60 commits to master since this release

New features

Converted to trait

Nested set features are now enabled using a trait and overrides as less methods as possible. For smooth transition, Node class is still available but is now deprecated and will be removed in the next significant release. Also, some methods were renamed (see changelog).

Scoping

You can now store multiple trees in the same table by filtering using model attributes. Read more.

Rebuilding a tree

In this release, tree rebuilding feature is added. You can completely rebuild a tree from an array. This can be used when you editing your tree on the client side and then sending full tree to the server. Algorithm updates nodes based on primary key, creates new ones and can delete nodes that are not on array. More info.

Descendants as a relation

Nodes now have descendants relation which can be eagerly loaded. This is helpful when you have a large tree and need to load few subtrees:

$nodes = Category::with('descendants')->whereIn('id', $idList)->get();

Other

hasParent and hasChildren is now deprecated in favor of default laravel functionality has('parent') and has('children').

Default order is no longer applied for siblings(), descendants(), prevNodes(), nextNodes().

Other small features and bug fixes. See changelog.