One-Line Confirmation Dialog in Laravel Livewire: Wire:Confirm
Here I want to introduce you to a little wonder that I'm always reading in the course documentation, which I'm sort of doing on the fly, so as to always have the latest, and it turns out to be precisely this:
wire:confirm
I think this tells us enough, and we could even leave it there because it's obviously pretty obvious, but we're going to do a little demonstration anyway. We're simply going to modify the button that, by default, calls a method called delete, so that now, by defining the previous parameter, a confirmation dialog box appears, and when pressed, the script defined in wire:click is executed:
<flux:button class="ml-3" variant='danger' size="xs" wire:click="delete({{ $c }})" wire:confirm="Are you sure you want to delete this category?">
{{ __('Delete') }}
</flux:button>