I am following multiple tutorials and each time people use a form to delete a row of data via a button.
Is there another cleaner way of doing this please? I find this very strange. I understand it is for security purpose but I am a bit surprised that there isn't a clever thing in Laravel that makes the deletion quicker to format.
Your definition of the term "clean" is rather strange.
Forms are used to set the http method to something other than GET.
This prevents users from deleting resources by just typing something into their address bar.
If you really wanted to, you could have a GET route for deletions, but that's a terrible idea and I don't feel comfortable giving an example that people might actually use.
What I meant by that is something like action="delete/{healper or something}/{id}" which would have created the deletion of the user.
Yes I totally understand the POST and GET methods, but it was my understanding that frameworks would have "somehow"(if I knew how I would have created it myself..) created some kind of helpers that replaces the whole form(code) by just a couple of words.
Just use a button and send a delete request with axios. Otherwise, you need to use a form so that you can post a delete request using a hidden field in Laravel. {{ method_field('DELETE') }}
as only the route and the model need to change then it would be quite easy to create a blade directive like
@deleteModel(thing.delete, $item)
The issue here is that implementation in this case uses bootstrap button and font-awesome icons so it's very specific to this implementation. This is probably why it's not boilerplated in the framework