protected function recursiveReorder($root, $parentId, $left)
    {
        $right = $left + 1;
        $children = array_get($root, 'children', []);
        foreach ($children as $child) {
            $right = $this->recursiveReorder($child, $root['id'], $right);
        }
        $this->move($root['id'], $parentId, $left, $right);
        $left = $right + 1;

        return $left;
    }
protected function recursiveReorder($root, $parentId, $left)
    {
        $right = $left + 1;
        $children = array_get($root, 'children', []);
        foreach ($children as $child) {
            $right = $this->recursiveReorder($child, $root['id'], $right);
        }
        $this->move($root['id'], $parentId, $left, $right);
        $left = $right + 1;

        return $left;
    }
protected function recursiveReorder ( $ root , $ parentId , $ left ) { $ right = $ left + 1 ; $ children = array_get ( $ root , 'children' , [ ] ) ; foreach ( $ children as $ child ) { $ right = $ this -> recursiveReorder ( $ child , $ root [ 'id' ] , $ right ) ; } $ this -> move ( $ root [ 'id' ] , $ parentId , $ left , $ right ) ; $ left = $ right + 1 ; return $ left ; }
Recursive reorder nested-set tree type.

@param $root
@param $parentId
@param $left

@return mixed
Recursive reorder nested - set tree type .