HasDialogs
trait HasDialogs
Trait HasDialogs.
Provides methods to dispatch dialog events (success, info, warning, error, confirm) from Livewire components to the frontend.
Methods
Fluent accessor for dialog methods.
Dispatch the dialog event to the frontend.
Build a standard dialog payload.
Show a success dialog.
Show an info dialog.
Show a warning dialog.
Show an error dialog.
Show a confirmation dialog.
Show a delete confirmation dialog (Danger/Destructive style).
Details
at line 18
HasDialogs
dialog()
Fluent accessor for dialog methods.
Allows usage like $this->dialog()->success(...).
at line 28
protected void
dispatchDialog(array $payload)
Dispatch the dialog event to the frontend.
at line 47
protected array
buildDialogPayload(string $type, string $title, string|null $description, string $icon, array $options = [])
Build a standard dialog payload.
at line 73
void
success(string $title, string|null $description = null, array $options = [])
Show a success dialog.
at line 85
void
info(string $title, string|null $description = null, array $options = [])
Show an info dialog.
at line 97
void
warning(string $title, string|null $description = null, array $options = [])
Show a warning dialog.
at line 109
void
error(string $title, string|null $description = null, array $options = [])
Show an error dialog.
at line 129
void
confirm(array $config)
Show a confirmation dialog.
Usage Example:
$this->dialog()->confirm([
'title' => 'Are you sure?',
'description' => 'This action cannot be undone.',
'accept' => ['label' => 'Yes, do it', 'method' => 'deleteParams', 'params' => [1]],
'reject' => ['label' => 'No, cancel'],
]);
at line 162
void
delete(string $title, string|null $description = null, array $options = [])
Show a delete confirmation dialog (Danger/Destructive style).