logout through anchor tag using form in laravel

 

<a href="{{ route('logout') }}" onclick="event.preventDefault(); 
            document.getElementById('logout-form').submit();" 
            style="margin-left: 4px">
    Logout
</a>

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

Post a Comment

أحدث أقدم