You linked to the old version of SweetAlert. Here's the link to SweetAlert2 - https://sweetalert2.github.io/ Scroll down to the examples and the one that says "A confirm dialog, with a function attached to the "Confirm"-button..." is a good template for what you want to do.
To implement this you would have to:
- Add a click event which fires the SweetAlert modal.
- In the
then()callback you need to make a ajax call to the route that corresponds to thehapus()method on your controller. The easiest and cleanest way to do this would be to use axios. - remove the
redirect()statement from your controller and change the current url with JavaScript.
But since you mentioned that you are new to JavaScript this might not be the best option at the moment. Before I started learning JavaScript I used Bootstrap modals which worked great for these kinds of confirmations - add a delete button that triggers a Bootstrap modal where the button that confirms deletion is wrapped within a form element that posts to your delete route. Much simpler and the idea is pretty much the same.