Skip to content
Advertisement

how to force delete in laravel 5.4

I made a user management system with soft deletion and force deletion options. However, I’m having trouble getting the force deletion option to work.

The route:

JavaScript

The relevant controller code:

JavaScript

The view code:

JavaScript

The error that I’m getting is

JavaScript

Why is it not working, and how can I fix it?

Advertisement

Answer

Try placing this route above your other user routes or user resource route. Also you’re trying to use route model binding with a soft deleted model, which won’t work. You need to use the id and delete it manually.

JavaScript

Edit: Also delete {{ method_field('DELETE') }} from your form, since the route method defined is post.

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