Home > Article > Backend Development > Introduction to PHP unlimited classification tree extension component
This article brings you an introduction to the PHP infinite classification tree extension component. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
PHP System Dendrogram
Laravel | PHP | |
---|---|---|
5.* | >=5.6.4 |
composer require dendrogram/dendrogram:v1.0
ConfigurationFirst register the ServiceProvider in the Laravel application, open the file config/app.php, add an item in providers:
'providers' => [ DenDroGram\DendrogramServiceProvider::class ]
Then publish the configuration file of the expansion package, use the following command :
php artisan vendor:publish
At this time, the dendrogram.php configuration file will be generated in the config directoryData import (Two tables and three custom functions)
php artisan migrate
Construction parameters | Method description | Method Parameters | Return | Remarks | |
---|---|---|---|---|---|
adjacency format data generates a directory structure tree | Root node id, each node displays information | Return html text string | Configure the route related to the view in dendrogram.php such as the operation node method | (new DenDroGram(AdjacencyList::class) )->operateNode($action,$data) | |
Node operation of adjacency format data | action addition, deletion and modification identification, data node details data | Return boolean | Note that the view corresponds to the data structure AdjacencyList::class | ##(new DenDroGram(AdjacencyList::class))->getTreeData ($node_id); | |
adjacency data is constructed into a multi-dimensional array | Root node id | Return array | Multi-dimensional Array structure | (new DenDroGram(NestedSet::class))->buildTree($node_id,['name']) | |
NestedSet format data generates a rhizomatic structure tree | Root node id, each node displays information | Returns html text string | View related in dendrogram.php Configure routes such as operating node methods | (new DenDroGram(NestedSet::class))->operateNode($action,$data) | |
Node operations for data in NestedSet format | action adds, deletes, and changes identifiers, data node details data | returns boolean | Note that the view corresponds to the data structure NestedSet: :class | ##(new DenDroGram(NestedSet::class))->getTreeData($node_id); | NestedSet data format |
Root node id | Return array | Multi-dimensional array structure | For example Chestnut |
View generated by adjacency data structure
##
The above is the detailed content of Introduction to PHP unlimited classification tree extension component. For more information, please follow other related articles on the PHP Chinese website!