Search code examples
phplaravellaravel-routing

The GET method is not supported, but i'm actually using POST method


I'm building this web application using Laravel, and i don't know why, but the loggout route is not working anymore. I'm trying to fix it, but i've encountered an error that, to me, simply doesn't make sense. To try and make it simpler to adjust, i'm using the logout form like this:

<form id="frm-logout" action="{{ route('logout') }}" method="POST">
      
    {{ csrf_field() }}

    <button type="submit">logout</button>

</form>

And when i click the button, i get this:

Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
The GET method is not supported for this route. Supported methods: HEAD.

So, if the form method is POST, why is it showing me that GET method is not supported?


Solution

  • Try to run the following commands:

    php artisan route:clear
    php artisan config:clear
    

    i hope it was useful !