menu-item-dropdown-user-menu.blade.php 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. @php( $logout_url = View::getSection('logout_url') ?? config('adminlte.logout_url', 'logout') )
  2. @php( $profile_url = View::getSection('profile_url') ?? config('adminlte.profile_url', 'logout') )
  3. @if (config('adminlte.usermenu_profile_url', false))
  4. @php( $profile_url = Auth::user()->adminlte_profile_url() )
  5. @endif
  6. @if (config('adminlte.use_route_url', false))
  7. @php( $profile_url = $profile_url ? route($profile_url) : '' )
  8. @php( $logout_url = $logout_url ? route($logout_url) : '' )
  9. @else
  10. @php( $profile_url = $profile_url ? url($profile_url) : '' )
  11. @php( $logout_url = $logout_url ? url($logout_url) : '' )
  12. @endif
  13. <li class="nav-item dropdown user-menu">
  14. {{-- User menu toggler --}}
  15. <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">
  16. @if(config('adminlte.usermenu_image'))
  17. <img src="{{ Auth::user()->adminlte_image() }}"
  18. class="user-image img-circle elevation-2"
  19. alt="{{ Auth::user()->name }}">
  20. @endif
  21. <span @if(config('adminlte.usermenu_image')) class="d-none d-md-inline" @endif>
  22. {{ Auth::user()->name }}
  23. </span>
  24. </a>
  25. {{-- User menu dropdown --}}
  26. <ul class="dropdown-menu dropdown-menu-lg dropdown-menu-right">
  27. {{-- User menu header --}}
  28. @if(!View::hasSection('usermenu_header') && config('adminlte.usermenu_header'))
  29. <li class="user-header {{ config('adminlte.usermenu_header_class', 'bg-primary') }}
  30. @if(!config('adminlte.usermenu_image')) h-auto @endif">
  31. @if(config('adminlte.usermenu_image'))
  32. <img src="{{ Auth::user()->adminlte_image() }}"
  33. class="img-circle elevation-2"
  34. alt="{{ Auth::user()->name }}">
  35. @endif
  36. <p class="@if(!config('adminlte.usermenu_image')) mt-0 @endif">
  37. {{ Auth::user()->name }}
  38. @if(config('adminlte.usermenu_desc'))
  39. <small>{{ Auth::user()->adminlte_desc() }}</small>
  40. @endif
  41. </p>
  42. </li>
  43. @else
  44. @yield('usermenu_header')
  45. @endif
  46. {{-- Configured user menu links --}}
  47. @each('adminlte::partials.navbar.dropdown-item', $adminlte->menu("navbar-user"), 'item')
  48. {{-- User menu body --}}
  49. @hasSection('usermenu_body')
  50. <li class="user-body">
  51. @yield('usermenu_body')
  52. </li>
  53. @endif
  54. {{-- User menu footer --}}
  55. <li class="user-footer">
  56. @if($profile_url)
  57. <a href="{{ $profile_url }}" class="nav-link btn btn-default btn-flat d-inline-block">
  58. <i class="fa fa-fw fa-user text-lightblue"></i>
  59. {{ __('adminlte::menu.profile') }}
  60. </a>
  61. @endif
  62. <a class="btn btn-default btn-flat float-right @if(!$profile_url) btn-block @endif"
  63. href="#" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
  64. <i class="fa fa-fw fa-power-off text-red"></i>
  65. {{ __('adminlte::adminlte.log_out') }}
  66. </a>
  67. <form id="logout-form" action="{{ $logout_url }}" method="POST" style="display: none;">
  68. @if(config('adminlte.logout_method'))
  69. {{ method_field(config('adminlte.logout_method')) }}
  70. @endif
  71. {{ csrf_field() }}
  72. </form>
  73. </li>
  74. </ul>
  75. </li>