Reputation: 482
I use default auth from Laravel 5.7, and make some changes to the login page display. I have logged in several times and can run normally, after I stayed a day, and I opened my app again, I found a problem, where the user I last used was still logged in (no logout / user session remained), even though already restarted. when I try to logout (using the logout function) it can get an error
MethodNotAllowedHttpException
No message
I'm not sure, is this a bug from the "Remember me" feature or not. I have been looking for a solution, but I didn't find it, maybe because of my incorrect query.
route list 2
Upvotes: 1
Views: 1258
Reputation: 556
Laravel 5.4+ uses post
method for logout so instead of simple url (get
) request you should post a form to logout.
Try Something Like this
<a href="#" onclick="document.getElementById('logout-form').submit();"> Logout</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
{{ csrf_field() }}
</form>
Upvotes: 2