Form method spoofing in Laravel 5.4
To inform Laravel that the form you’re currently submitting should be treated as something other than POST, add a hidden variable named _method with the value of either PUT, PATCH, or DELETE, and Laravel will match and route that form submission as if it were actually a request with that verb.
<form action="/tasks/5" method="POST">
<input type="hidden" name="_method" value="DELETE">
</form>
It passes Laravel the method of “DELETE,” will match routes defined with Route::delete but not those with Route::post.
<form action="/tasks/5" method="POST">
<input type="hidden" name="_method" value="DELETE">
</form>
It passes Laravel the method of “DELETE,” will match routes defined with Route::delete but not those with Route::post.
Comments
Post a Comment