_header.blade.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <nav class="navbar navbar-expand-lg navbar-light bg-light navbar-static-top">
  2. <div class="container">
  3. <!-- Branding Image -->
  4. <a class="navbar-brand " href="{{ url('/') }}">
  5. Laravel Shop
  6. </a>
  7. <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
  8. <span class="navbar-toggler-icon"></span>
  9. </button>
  10. <div class="collapse navbar-collapse" id="navbarSupportedContent">
  11. <!-- Left Side Of Navbar -->
  12. <ul class="navbar-nav mr-auto">
  13. </ul>
  14. <!-- Right Side Of Navbar -->
  15. <ul class="navbar-nav navbar-right">
  16. <!-- 登录注册链接开始 -->
  17. @guest
  18. <li class="nav-item"><a class="nav-link" href="{{ route('login') }}">登录</a></li>
  19. <li class="nav-item"><a class="nav-link" href="{{ route('register') }}">注册</a></li>
  20. @else
  21. <li class="nav-item dropdown">
  22. <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  23. <img src="https://cdn.learnku.com/uploads/images/201709/20/1/PtDKbASVcz.png?imageView2/1/w/60/h/60" class="img-responsive img-circle" width="30px" height="30px">
  24. {{ Auth::user()->name }}
  25. </a>
  26. <div class="dropdown-menu" aria-labelledby="navbarDropdown">
  27. <a href="{{ route('user_addresses.index') }}" class="dropdown-item">收货地址</a>
  28. <a class="dropdown-item" id="logout" href="#"
  29. onclick="event.preventDefault();document.getElementById('logout-form').submit();">退出登录</a>
  30. <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
  31. {{ csrf_field() }}
  32. </form>
  33. </div>
  34. </li>
  35. @endguest
  36. <!-- 登录注册链接结束 -->
  37. </ul>
  38. </div>
  39. </div>
  40. </nav>