<div class="ub-menu">
    @foreach($tree as $group)
        <div class="title">
            <i class="iconfont icon-list1"></i>
            {{$group['name']}}
        </div>
        <div class="items">
            @foreach($group['_child'] as $item)
                <a @if($id==$item['id']) class="active" @endif href="/article_list/{{$item['id']}}">{{$item['name']}}</a>
            @endforeach
        </div>
    @endforeach
</div>
<script>
    $(function () {
        var $menu = $('.ub-menu');
        $menu.find('.items .active').parent().show();
        $menu.find('.title').on('click',function () {
            var $next = $(this).next();
            $next.is(':visible')?$next.slideUp():$next.slideDown();
        });
    });
</script>
