I am trying to allow users to edit their playlist. However, whenever I try to execute the PATCH request, I get the MethodNotAllowed
As suggested by @Michael A in the comment above, send it as a POST
<form method="POST" action="patchlink">
<input type="hidden" name="_method" value="PATCH">
Worked for me.
Since html forms support only GET
and POST
you need to add an extra hidden field
to the form called _method
in order to simulate a PATCH
request
<input type="hidden" name="_method" value="PATCH">
Write {!! method_field('patch') !!}
after form:
<form method="POST" action="patchlink">
{!! method_field('patch') !!}
. . .
</form>
Official documentation for helper function method_field()
In Laravel 5 and up:
<form method="POST" action="patchlink">
@method('patch')
. . .
</form>