php - Laravel delete button throwing out error "page couldn't be found -
this code
view
<form action="/categories/ {{ $category->id }}" method="post"> {{ csrf_field() }} {{ method_field('delete') }} <button>delete task</button> </form>
controller method
public function destroycategory($id) { categories::findorfail($id)->delete(); return redirect('/categories'); }
route
route::post('categories','filescontroller@destroycategory');
form in partial view, can problem
you send delete
method form catch post
instead of delete
inside route
file & not assign url
parameter in route
file.
<form action="/categories/{{ $category->id }}" method="post"> {{ csrf_field() }} {{ method_field('delete') }} <button type="submit">delete task</button> </form>
route.php
route::delete('categories/{id}','filescontroller@destroycategory');
Comments
Post a Comment