The only methods that are valid within a form tag are "GET" and "POST". Since "DELETE" isn't valid, it's probably falling back on "GET".
However, Laravel has a way around this. Just add a hidden input inside of the form with a name of
<input type="hidden" name="_method" value="delete" />
Let me know how this works!
P.S. It also looks like you're not returning anything in your destroy method. You should be returning a view, or a redirect.
the url display http://localhost:8000/products/productsname?_method=delete and still displays 'products.show' route
when i try other method error:
MethodNotAllowedHttpException in RouteCollection.php line 219: in RouteCollection.php line 219 at RouteCollection->methodNotAllowed(array('GET', 'HEAD', 'PUT', 'PATCH', 'DELETE')) in RouteCollection.php line 206 at RouteCollection->getRouteForMethods(object(Request), array('GET', 'HEAD', 'PUT', 'PATCH', 'DELETE')) in RouteCollection.php line 158
I'm so fool I should using POST method and it works, now it calls to the right route name. thanks for pointing that out. I'm to focused to the error message
Sign in to participate in this thread!
We'd like to thank these amazing companies for supporting us