In this episode, we add the ability to delete endpoints from our app. We kick things off with a quick housekeeping fix—displaying the current number of endpoints on the dashboard, just by counting our endpoint data. Then, the main event: setting up a delete flow for endpoints using Inertia.js, so everything happens smoothly with no page reloads.
We walk through adding a delete endpoint button, hooking it up to send a delete request to our Laravel backend, and seeing how Inertia automatically updates the UI. Along the way, we toss in a quick JavaScript confirm dialog to prevent accidental deletes—super basic but effective!
Once the flow works and endpoints disappear from the UI just like magic, it's time to secure things. We set up a proper form request for deleting endpoints and add the necessary authorization by creating a new policy. This ensures only the user who owns an endpoint's site can actually delete it. With everything in place, we test it out to confirm the delete and authorization logic works as expected.
By the end of this one, deleting endpoints is seamless, secure, and instant—no page reloads required!