protected function getBranch($pages)
    {
        $result = [];

        foreach ($pages as $page) {
            $result[] = array('model' => $page, 'children' => $this->renderTree($page->id));
        }

        return $result;
    }
protected function getBranch($pages)
    {
        $result = [];

        foreach ($pages as $page) {
            $result[] = array('model' => $page, 'children' => $this->renderTree($page->id));
        }

        return $result;
    }
protected function getBranch ( $ pages ) { $ result = [ ] ; foreach ( $ pages as $ page ) { $ result [ ] = array ( 'model' => $ page , 'children' => $ this -> renderTree ( $ page -> id ) ) ; } return $ result ; }
Returns the given pages as a branch.
@param $pages
@return array
Returns the given pages as a branch .