@php  
    $logo = \App\Models\Utility::getLogo(); 
@endphp
<!-- Main Sidebar Container -->
 <aside class="main-sidebar sidebar-dark-primary elevation-4">
    <!-- Brand Logo -->
    <a href="#" class="brand-link">
      {{-- <img src="{{ asset('dist/img/AdminLTELogo.png') }}" alt="AdminLTE Logo" class="brand-image img-circle elevation-3" style="opacity: .8"> --}}
      <img src="{{ asset($logo) }}" alt="Suhu Logo" class="brand-image img-circle elevation-3" style="opacity: .8">
      <span class="brand-text font-weight-light">{{ config('app.name', 'Laravel') }}</span>
    </a>

    <!-- Sidebar -->
    <div class="sidebar">
      
      <!-- SidebarSearch Form -->
      <div class="form-inline">
        <div class="input-group" data-widget="sidebar-search">
          <input class="form-control form-control-sidebar" type="search" placeholder="Search" aria-label="Search">
          <div class="input-group-append">
            <button class="btn btn-sidebar">
              <i class="fas fa-search fa-fw"></i>
            </button>
          </div>
        </div>
      </div>

      <!-- Sidebar Menu -->
      <nav class="mt-2">
        <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
          <!-- Add icons to the links using the .nav-icon class
               with font-awesome or any other icon font library -->
               @php 
               $menus = listMenu();     
               @endphp
               @foreach ($menus as $menu)
               
                 @php
                   $permission = $menu->permission->name;
                   
                   $arrMenuRequest = explode('~',$menu->request);
                   $strMenuRequest = "";
                   if(count($arrMenuRequest)>1)
                   {
                     foreach($arrMenuRequest as $arrMenu)
                     {
                       $strMenuRequest .= Request::routeIs($arrMenu)." || ";
                     }
                     $strMenuRequest = rtrim($strMenuRequest," || ");
                   }
                   else 
                   {
                     $strMenuRequest .= Request::routeIs($menu->request);
                   } 
                 @endphp
                 @can($permission)
                   <li class="nav-item {{ ($strMenuRequest) ? 'menu-open' : '' }}" >
                     <a href="{{ ($menu->route == '#' ) ?'#':route($menu->route) }}" class="nav-link {{ ($strMenuRequest) ? 'active' : '' }}">
                       <i class="nav-icon {{ $menu->icon }}"></i>
                       <p>
                         {{ ucfirst($menu->menu_name) }}
                        @if(count($menu->childs))
                         <i class="right fas fa-angle-left"></i>
                         @endif
                       </p>
                     </a>
                                    
                         @if(count($menu->childs))
                           @include('pages.menu.sub-menu',['childs' => $menu->childs])
                         @endif                  
                     
                   </li>
                 @endcan
               @endforeach    
        </ul>
      </nav>
      <!-- /.sidebar-menu -->
    </div>
    <!-- /.sidebar -->
  </aside>