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

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -