DEV Community

Chidiebere Chukwudi
Chidiebere Chukwudi

Posted on

[Solved] The POST method is not supported for this route. Supported methods: GET, HEAD. Laravel

Quick Solution and straight to the point no bulky intro(this is my intro though)

Solution: If you are trying to make an update request and you are using laravel route resource to manage your routing, this solution should work for you

<form action="{{ route('article.update', $article->id) }}" method="POST">
 @csrf
@method('PUT')
Enter fullscreen mode Exit fullscreen mode

Noticed the @method('PUT') ? This is because laravel resource route natviely uses the "PUT" verb for handling your form actions.

Hint:
If you defined the route by yourself with out the route resource, you can make use of the "POST" verb and it will definitely work!

For example:

<form action="/articles/update/{{$article->id}}" method="POST">
        @csrf
Enter fullscreen mode Exit fullscreen mode

Ndewo!

Discussion (0)