Normal HTML forms do not support the PUT, PATCH, or DELETE actions. That's why while defining the PUT, PATCH or DELETE routes which are being called from an HTML form, you will have to add a hidden _method field to the form.

The value which is sent with the _method field will get used as the HTTP request method, like this:

Example

                                        

<form action="/foo/bar" method="POST">

    <input type="hidden" name="_method" value="PUT">

    <input type="hidden" name="_token" value="{{ csrf_token() }}">

</form>

 To generate the _method input, you can use the @method Blade Directive, like this:

<form action="/foo/bar" method="POST">

    @method('PUT')

    @csrf

</form>

 This is called method spoofing in Laravel.

Suggest An Answer

No suggestions Available!