How to use delete method in route in laravel 5.2

I want to use the delete route in my laravel project.


just like you want to send a route from the href anchor tag.
is it possible to use the delete method in the route from the "href" binding mark
 Route::delete('/news/{id}', 'NewsController@destroy');
+4
source share
2 answers

You cannot use the anchor tag with href to send a delete request. You need a form to do so. Using the DELETE method, since in the form we receive only the message and create a hidden field with the name _method and the value DELETE Create a form similar to this:

<form action="news/id" method="post">
<input type="hidden" name="token" value="{{csrf_token}}" >
<input type="hidden" name="_method" value="DELETE" >
<input type="submit" value="delete " >
</form>
+3
source
Route::resource('/news/{id}', 'NewsController@destroy');

and then select post, put, delete ...

enter image description here

+2

All Articles