Download the PHP package sammaye/yii2-nested-sets without Composer
On this page you can find all versions of the php package sammaye/yii2-nested-sets. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sammaye/yii2-nested-sets
More information about sammaye/yii2-nested-sets
Files in sammaye/yii2-nested-sets
Package yii2-nested-sets
Short Description The nested sets behavior for the Yii framework
License BSD-3-Clause
Informations about the package yii2-nested-sets
Nested Sets Behavior for Yii 2
A modern nested sets behavior for the Yii framework utilizing the Modified Preorder Tree Traversal algorithm.
Installation
The preferred way to install this extension is through composer.
Either run
or add
to the require
section of your composer.json
file.
Migrations
Run the following command
Open the /path/to/migrations/m_xxxxxx_xxxxxx_create_menu_table.php
file,
inside the up()
method add the following
To use multiple tree mode uncomment tree
field.
Configuring
Configure model as follows
To use multiple tree mode uncomment treeAttribute
array key inside behaviors()
method.
Configure query class as follows
Usage
Making a root node
To make a root node
The tree will look like this
Prepending a node as the first child of another node
To prepend a node as the first child of another node
The tree will look like this
Appending a node as the last child of another node
To append a node as the last child of another node
The tree will look like this
Inserting a node before another node
To insert a node before another node
The tree will look like this
Inserting a node after another node
To insert a node after another node
The tree will look like this
Getting the root nodes
To get all the root nodes
Getting the leaves nodes
To get all the leaves nodes
To get all the leaves of a node
Getting children of a node
To get all the children of a node
To get the first level children of a node
Getting parents of a node
To get all the parents of a node
To get the first parent of a node
Donating
Support this project and others by creocoder via gratipay.