component = $component; $this->props = $props; $this->size = $size; $this->title = $title; $this->key = md5(json_encode(['component' => $component, 'props' => $props])); $this->actions = $this->parseActions($actions); } public function parseActions(array $actions): array { return collect($actions)->map(function ($action) { if ($action === 'closeable') { return ['event' => 'closeModal', 'icon' => 'close', 'label' => 'Schließen']; } if ($action === 'storeable') { return ['event' => 'onStoreFromModal', 'icon' => 'save', 'label' => 'Speichern']; } return $action; })->toArray(); } #[On('closeModal')] public function onCloseModal(): void { $this->reset(); } public function sizeClass(): string { if ($this->size === 'lg') { return 'max-w-lg'; } if ($this->size === 'xl') { return 'max-w-xl'; } return ''; } public function render() { return <<<'HTML'
HTML; } }