src/Tree/Traits/TreeTrait.php
public function getLayerOfDescendants($id)
    {
        $child = $this->getSubLevel($id);
        $data = collect([]);
        if ($child) {
            foreach ($child as $val) {
                $val->child = $this->getLayerOfDescendants($val->{$this->getTreeNodeIdName()});
                $data->put($val->{$this->getTreeNodeIdName()}, $val);
            }
        }

        return $data;
    }
public function getLayerOfDescendants($id)
    {
        $child = $this->getSubLevel($id);
        $data = collect([]);
        if ($child) {
            foreach ($child as $val) {
                $val->child = $this->getLayerOfDescendants($val->{$this->getTreeNodeIdName()});
                $data->put($val->{$this->getTreeNodeIdName()}, $val);
            }
        }

        return $data;
    }
获取指定节点的所有后代（分层级）.

@param mixed $id

@return \Illuminate\Support\Collection