I was working on an admin panel using backpack for Laravel. When I want to delete some item by hitting the delete button, I get a Not Deleted error - see screenshots.
It looks like the 403 and 405 errors that can occur when the CRUD::resource()
or Route::resource
method are used but the server (apache in my case) does not allow them on dynamic resources - whatever that means in detail ...
Is there a way to enable these methods on Apache?
I got it working, but I would like to use the default HTTP methods.
Quick Fix
I was able to fix this problem by duplicating and modifying the list.blade.php
CRUD view of backpack.
Duplicate the view
vendor/backpack/crud/src/resources/views/list.blade.php
and move it toresources/views/vendor/backpack/crud/list.blade.php
Modify the AJAX request defined on line 271.
if (confirm("{{ trans('backpack::crud.delete_confirm') }}") == true) { $.ajax({ url: delete_url, type: 'POST', // change from DELETE to POST data: { // "spoof" the HTTP verb "DELETE" "_method": "DELETE" },