<div class="ui left inline vertical sidebar push visible">
    <div class="ui inverted vertical following fluid accordion menu">
        <a href="{{ url('/admin/index') }}" class="item">
            <h5 class="ui inverted header">
                <div class="content">
                    後台管理系統
                </div>
            </h5>
        </a>
    @foreach($navs as $v)
        @if( count($v->child()) )
        <div class="item">
            <a href="#" class="title {{ in_array(Request::segment(1), $v->childary())?'active':'' }}">
                <i class="dropdown icon"></i>
                <b>{{ $v->name }}</b>
            </a>
            <div class="content {{ in_array(Request::segment(1), $v->childary())?'active':'' }}">   
                @foreach($v->child() as $c)
                @if( Auth::user()->id==1 || ( Auth::user()->id>1 && in_array($c->slug, Session::get('permission')) ) )
                <a href="{{ url($c->slug) }}" class="item @if($c->slug==Request::segment(1)) active @endif">{{ $c->name }}
                    @if($c->count > 0)
                    <div class="ui red label">{{$c->count}}</div>
                    @endif
                </a>
                @endif
                @if($c->divider)
                <div class="divider"></div>
                @endif
                @endforeach
            </div>
        </div>
        @else
        <a href="{{ url($v->slug) }}" class="item @if($v->slug==Request::segment(1)) active @endif">
            {{ $v->name }}
        </a>
        @endif
    @endforeach
    </div>
</div>