public static function categoriesMenu($categories)
    {
        $menu = '<ul class="nav nav-pills nav-stacked">';

        foreach ($categories as $category) {
            $menu .= '<li>';
            $menu .= '<a href="/'.config('chatter.routes.home').'/'.config('chatter.routes.category').'/'.$category['slug'].'">';
            $menu .= '<div class="chatter-box" style="background-color:'.$category['color'].'"></div>';
            $menu .= $category['name'].'</a>';

            if (count($category['parents'])) {
                $menu .= static::categoriesMenu($category['parents']);
            }

            $menu .= '</li>';
        }

        $menu .= '</ul>';

        return $menu;
    }
public static function categoriesMenu($categories)
    {
        $menu = '<ul class="nav nav-pills nav-stacked">';

        foreach ($categories as $category) {
            $menu .= '<li>';
            $menu .= '<a href="/'.config('chatter.routes.home').'/'.config('chatter.routes.category').'/'.$category['slug'].'">';
            $menu .= '<div class="chatter-box" style="background-color:'.$category['color'].'"></div>';
            $menu .= $category['name'].'</a>';

            if (count($category['parents'])) {
                $menu .= static::categoriesMenu($category['parents']);
            }

            $menu .= '</li>';
        }

        $menu .= '</ul>';

        return $menu;
    }
public static function categoriesMenu ( $ categories ) { $ menu = '<ul class="nav nav-pills nav-stacked">' ; foreach ( $ categories as $ category ) { $ menu .= '<li>' ; $ menu .= '<a href="/' . config ( 'chatter.routes.home' ) . '/' . config ( 'chatter.routes.category' ) . '/' . $ category [ 'slug' ] . '">' ; $ menu .= '<div class="chatter-box" style="background-color:' . $ category [ 'color' ] . '"></div>' ; $ menu .= $ category [ 'name' ] . '</a>' ; if ( count ( $ category [ 'parents' ] ) ) { $ menu .= static :: categoriesMenu ( $ category [ 'parents' ] ) ; } $ menu .= '</li>' ; } $ menu .= '</ul>' ; return $ menu ; }
This function construct the categories menu with nested categories.

@param array $categories

@return string
This function construct the categories menu with nested categories .