Jump to another example:
Basics
Store
Composables
Events
Forms
Features
Feature Showcase: #[Confirm]
Require explicit user confirmation before running sensitive actions.
How it works
Use #[Confirm] on PHP methods.
When the user triggers the action, LiVue asks confirmation on the client side before sending the request.
With native browser dialogs, only the message is shown.
Items
0
Last action
None
#[Confirm] intercepts the call on the client. If user cancels, no AJAX request is sent. Native browser dialogs show only the message; custom title/buttons require LiVue.setConfirmHandler(). For camelCase methods, use v-click="methodName" to preserve case.
app/LiVue/ConfirmActionDemo.php
use LiVue\Attributes\Confirm;
#[Confirm('Reset all items? This cannot be undone.')]
public function resetItems(): void
{
$this->items = 0;
}
resources/views/livue/confirm-action-demo.blade.php
<button v-click="resetItems">
Reset (Confirm)
</button>