HasDialogs
trait HasDialogs
Trait HasDialogs.
Provides methods to dispatch dialog events (success, info, warning, error, confirm) from Livewire components to the frontend.
Methods
dialog()
Fluent accessor for dialog methods.
void
dispatchDialog(array $payload)
Dispatch the dialog event to the frontend.
void
success(string $title, string|null $description = null, array $options = [])
Show a success dialog.
void
info(string $title, string|null $description = null, array $options = [])
Show an info dialog.
void
warning(string $title, string|null $description = null, array $options = [])
Show a warning dialog.
void
error(string $title, string|null $description = null, array $options = [])
Show an error dialog.
void
confirm(array $config)
Show a confirmation dialog.
void
delete(string $title, string|null $description = null, array $options = [])
Show a delete confirmation dialog (Danger/Destructive style).
Details
at line 20
HasDialogs
dialog()
Fluent accessor for dialog methods.
Allows usage like $this->dialog()->success(...).
at line 31
protected void
dispatchDialog(array $payload)
Dispatch the dialog event to the frontend.
at line 47
void
success(string $title, string|null $description = null, array $options = [])
Show a success dialog.
at line 75
void
info(string $title, string|null $description = null, array $options = [])
Show an info dialog.
at line 102
void
warning(string $title, string|null $description = null, array $options = [])
Show a warning dialog.
at line 129
void
error(string $title, string|null $description = null, array $options = [])
Show an error dialog.
at line 164
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 200
void
delete(string $title, string|null $description = null, array $options = [])
Show a delete confirmation dialog (Danger/Destructive style).