Skip to content
Advertisement

Resource controller destroy method not working

I have a button on my CRUD application that looks like this:

JavaScript

When the user clicks the button it loads the show method in my resource controller and not the destroy method.

My routes:

JavaScript

Why is it not using the correct controller method?

Advertisement

Answer

Any HTTP action pointing to POST, PUT, or DELETE routes that are defined in the web routes file should include a CSRF token field. Otherwise, the request will be rejected. You can read more about CSRF protection in the CSRF documentation:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement