Blade checking if auth Admin is logged in

Posted 1 year ago by bigboichuverloo2

How do i check if admin is logged in ?

@if (Auth::guest())

        <a class="nav-link" href="{{ route('login') }}">Sign in</a>

        @else 

         <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownPortfolio" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
           {{ Auth::user()->email }} <span class="caret"></span>
         </a>

         
            <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownPortfolio">
                <a class="dropdown-item" href="#">Profile Settings</a>
                <a class="dropdown-item" href="#">History</a>
                <a class="dropdown-item" href="{{ route('logout') }}"
                onclick="event.preventDefault();
                document.getElementById('logout-form').submit();">
                Logout
              </a>


            </div>
          <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
            {{ csrf_field() }}
          </form>
       
    </li>
    @endif

Please sign in or create an account to participate in this conversation.