Mesiek
Mesiek

Reputation: 11

MethodNotAllowedHttpException - No message

I have a problem. Log in, registration is working but when I want to log out I get this error: MethodNotAllowedHttpException - No message

Error link: http://gazeta1.nazwa.pl/mesiek/error.html

Upvotes: 0

Views: 5860

Answers (3)

ParisaN
ParisaN

Reputation: 2092

I got this error when I used get and post methods instead of each other. for example, instead of get user's data, use post method.

Upvotes: 0

Franz
Franz

Reputation: 354

try setting your .env file set

DB_HOST=localhost

and run

php artisan config:cache

from your CLI hopes this works for you :)

Upvotes: 0

kofoworola
kofoworola

Reputation: 557

Method not allowed on logout route possibly means you are calling /logout via a get request (normal /logout link), whereas the logout request is meant to be called via post.

Here's a logout code snippet from the default laravel app when you create a new project

<a href="{{ url('logout')}}" onclick="event.preventDefault();
document.getElementById('logout-form').submit();">
    <i class="icon-key"></i> Log Out 
</a>
<form id="logout-form" action="{{ url('/logout') }}" method="POST" style="display: none;">
    {{ csrf_field() }}
</form>

The actual logout is called via a hidden form and the link just submits the form.

But i'm not certain since you did not include any code or details in your question

Upvotes: 1

Related Questions