*/ public array $params = []; /** Toast shown on confirm. Pass '' to defer the notification to the handler * (e.g. when the real outcome is only known after a remote command runs); * leave null to fall back to the generic default toast. */ public ?string $notify = null; public static function modalMaxWidth(): string { return 'md'; } /** Apply localized fallbacks for any copy the opener did not pass. */ public function boot(): void { if ($this->heading === '') { $this->heading = __('modals.confirm_action.default_heading'); } if ($this->confirmLabel === '') { $this->confirmLabel = __('common.confirm'); } if ($this->notify === null) { $this->notify = __('modals.confirm_action.default_notify'); } } public function confirm(): void { if ($this->auditAction !== '') { AuditEvent::create([ 'user_id' => Auth::id(), 'server_id' => $this->serverId, 'actor' => Auth::user()?->name ?? 'system', 'action' => $this->auditAction, 'target' => $this->auditTarget, 'ip' => request()->ip(), ]); } if ($this->event !== '') { $this->dispatch($this->event, ...$this->params); } // Empty notify = the handler will report the real outcome itself. if ($this->notify !== '') { $this->dispatch('notify', message: $this->notify); } $this->closeModal(); } public function render() { return view('livewire.modals.confirm-action'); } }