Just learning Laravel and found that in Laravel's quick start guide, they suggest for a "delete" request, you can spoof the method as if it is "delete" rather than GET or POST by doing this:
{{ method_field('DELETE') }}
Which generates this html:
<input type="hidden" name="_method" value="DELETE">
And in Laravel back end let's you use the router like this:
Route::delete('/task/{task}', function (Task $task) {
// do something here
});
But the question is, why do that when I can just set the action of the form to '/task/delete' and use this in the back end:
Route::post('/task/delete/{task}', function (Task $task) {
// do something here
});
No magic 'spoofing' and more consistent, so any reason to spoof?