'Logout route issues in laravel web application
When I logged out from my laravel application and logged in again when I click on the logout button, the button is clickable but it is not going in the controller logout method. I have checked it by writing dd() and exit in the logout controller but they are not getting executed.
Every page is clickable and they are working properly except the logout route.
What should i do ??
Solution 1:[1]
For me this works:
<a href="{{ route('logout') }}"
onclick="event.preventDefault();
document.getElementById('logout-form').submit();">
{{ __('Logout') }}
</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
@csrf
</form>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Searche |
