44 lines
875 B
PHP
44 lines
875 B
PHP
<?php
|
|
|
|
namespace App\Livewire\Modals;
|
|
|
|
use Illuminate\View\View;
|
|
use LivewireUI\Modal\ModalComponent;
|
|
|
|
class ConfirmAction extends ModalComponent
|
|
{
|
|
public string $title = 'Confirm';
|
|
|
|
public string $message = 'Are you sure?';
|
|
|
|
public string $confirmLabel = 'Confirm';
|
|
|
|
public string $cancelLabel = 'Cancel';
|
|
|
|
public string $confirmEvent = '';
|
|
|
|
/** @var array<int|string, mixed> */
|
|
public array $confirmEventParams = [];
|
|
|
|
public bool $danger = false;
|
|
|
|
public function confirm(): void
|
|
{
|
|
if ($this->confirmEvent) {
|
|
$this->dispatch($this->confirmEvent, ...$this->confirmEventParams);
|
|
}
|
|
|
|
$this->closeModal();
|
|
}
|
|
|
|
public static function modalMaxWidth(): string
|
|
{
|
|
return 'sm';
|
|
}
|
|
|
|
public function render(): View
|
|
{
|
|
return view('livewire.modals.confirm-action');
|
|
}
|
|
}
|