Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Nestedset Laravel Package

kalnoy/nestedset

Laravel Eloquent implementation of the Nested Set model for storing hierarchical data. Manage trees with fast reads: add, move, delete nodes, retrieve ancestors/descendants, build menus, and handle multiple roots with scoped trees, all via familiar model methods.

View on GitHub
Deep Wiki
Context7
v6.0.6

What's Changed

New Contributors

Full Changelog: https://github.com/lazychaser/laravel-nestedset/compare/v6.0.5...v6.0.6

v4.1.0

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.

v4.1.0-beta
  • #75: Converted to trait. Following methods were renamed:
  • appendTo to appendToNode
  • prependTo to prependToNode
  • insertBefore to insertBeforeNode
  • insertAfter to insertAfterNode
  • getNext to getNextNode
  • getPrev to getPrevNode
  • #82: Fixing tree now handles case when nodes pointing to non-existing parent
  • The number of missing parent is now returned when using countErrors
  • #79: implemented scoping feature
  • #81: moving node now makes model dirty before saving it
  • #45: descendants is now a relation that can be eagerly loaded
  • hasChildren and hasParent are now deprecated. Use has('children') has('parent') instead
  • Default order is no longer applied for siblings(), descendants(), prevNodes, nextNodes
  • #50: implemented tree rebuilding feature
v2.0-beta2
v2.0-beta
v1.1
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4