
@php

    if (Cms::translatable($items)) {
        $items = $items->load('translations');
    }
$i=0;
$itemss=$items->sortBy('order');
$count=count($itemss);
@endphp




@foreach ($itemss as $item)

    @php

    if(Cms::getCount($item->menu_id)){
    print " <a  title=\"Hosting\" href=\"#\">".$item->title."<span class=\"caret\"></span></a>
     <ul role=\"menu\" class=\" dropdown-menu\">

    ";
    $first=1;
    }else{
    $first=2;
    }

        $originalItem = $item;
        if (Cms::translatable($item)) {

            $item = $item->translate($options->locale);
        }

        $isActive = null;
        $styles = null;
        $icon = null;

        // Background Color or Color
        if (isset($options->color) && $options->color == true) {
            $styles = 'color:'.$item->color;
        }
        if (isset($options->background) && $options->background == true) {
            $styles = 'background-color:'.$item->color;
        }

        // Check if link is current
        if(url($item->link()) == url()->current()){
            $isActive = 'active';
        }

        // Set Icon
        if(isset($options->icon) && $options->icon == true){
            $icon = '<i class="' . $item->icon_class . '"></i>';
        }


    @endphp

    <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1227">
        <a href="{{ url($item->link()) }}" target="{{ $item->target }}" style="{{ $styles }}">
            {!! $icon !!}
            {{ $item->title }}
        </a>
        @if(!$originalItem->children->isEmpty())
            @include('Cms::menu.default', ['items' => $originalItem->children, 'options' => $options])
        @endif
    </li>

    @php


//print $i."-".$first."-".$item->menu_id."-".$item->title;

    if( $i==0 and $first==1){
      print "</ul>";
    }
    $i++;
//!isset($first) and
            @endphp



@endforeach

