dispatch( 'open-confirmation', componentId: $this->getId(), action: $method, params: $params, title: $title, subtitle: $subtitle, description: $description, descriptionClass: $descriptionClass, acceptBtnClass: $acceptBtnClass, icon: $icon ); } /** * Listen globally for the acceptance, but only process if the ID matches. */ #[On('confirmation-accepted')] public function onConfirmationAccepted(string $action, mixed $params, string $componentId): void { // Ignore the event if it wasn't requested by this specific component instance if ($this->getId() !== $componentId) { return; } // Verify the method actually exists on the component if (method_exists($this, $action)) { // Execute the requested method, passing any provided parameters $this->{$action}($params); } } }