2017 © Pedro Peláez
 

library tree

tree

image

scolib/tree

tree

  • Wednesday, January 3, 2018
  • by klgd
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1,021 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

ScoLib/tree

是一个将数据格式化为树形结构的类库, (*1)

StyleCI Latest Stable Version Total Downloads Latest Unstable Version License, (*2)

安装

执行命令:, (*3)

bash composer require scolib/tree, (*4)

或 在 composer.json 文件中:, (*5)

"require": { "scolib/tree": "^1.0" } 并执行 composer update, (*6)

使用

<?php 
namespace App\Repositories;

use Sco\Tree\Traits\TreeTrait;

class MyClass
{
    use TreeTrait;

    // 自定义属性(可选)
    protected $treeNodeIdName = 'id';
    protected $treeNodeParentIdName = 'parent_id';
    protected $treeSpacer = '&nbsp;&nbsp;&nbsp;';
    protected $treeFirstIcon = '&nbsp;&nbsp;&nbsp;│ ';
    protected $treeMiddleIcon = '&nbsp;&nbsp;&nbsp;├─ ';
    protected $treeLastIcon = '&nbsp;&nbsp;&nbsp;└─ ';

    /**
     * 获取待处理的原始节点数据
     * 
     * 必须实现
     * 
     * return \Illuminate\Support\Collection
     */
    public function getTreeAllNodes()
    {

    }
}

可用方法

public function setAllNodes(Collection $nodes)
public function getSubLevel($parentId)
public function getDescendants($parentId, $depth = 0, $adds = '')
public function getLayerOfDescendants($id)
public function getSelf($id)
public function getParent($id)
public function getAncestors($id, $depth = 0)

The Versions

03/01 2018

dev-master

9999999-dev

tree

  Sources   Download

Apache-2.0

The Requires

 

02/03 2017

v1.0.3

1.0.3.0

tree

  Sources   Download

Apache-2.0

The Requires

 

02/03 2017

1.0.x-dev

1.0.9999999.9999999-dev

tree

  Sources   Download

Apache-2.0

The Requires

 

24/12 2016

v1.0.2

1.0.2.0

tree

  Sources   Download

Apache-2.0

The Requires

 

30/10 2016

v1.0.1

1.0.1.0

tree

  Sources   Download

Apache-2.0

The Requires

 

02/09 2016

v1.0.0

1.0.0.0

tree

  Sources   Download

Apache-2.0

The Requires