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.






Comments

Popular posts from this blog

Fatal: LoadModule: error loading module 'mod_sql_mysql.c'

Regular Expression Route Constraints And Route Names in Laravel 5.4