0

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

Mesiek
  • 11
  • 1
  • 1
  • 1
    share your sample code, or what you tried that gave you the error – kofoworola Nov 22 '17 at 21:41
  • 1
    Possible duplicate of [laravel throwing MethodNotAllowedHttpException](https://stackoverflow.com/questions/19760585/laravel-throwing-methodnotallowedhttpexception) – Camilo Nov 22 '17 at 22:41

3 Answers3

1

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

kofoworola
  • 557
  • 1
  • 5
  • 14
0

try setting your .env file set

DB_HOST=localhost

and run

php artisan config:cache

from your CLI hopes this works for you :)

Franz
  • 354
  • 1
  • 4
  • 15
0

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.

ParisaN
  • 1,816
  • 2
  • 23
  • 55