'required|url|max:2048', 'slug' => 'nullable|alpha_dash|max:50|unique:links,slug', 'title' => 'nullable|max:200', ]; public function generateSlug(): void { if (empty($this->slug)) { $this->slug = Str::random(6); } } public function save(): void { $this->validate(); $workspace = app('current_workspace'); if (empty($this->slug)) { $this->slug = Str::random(6); } Link::create([ 'workspace_id' => $workspace->id, 'target_url' => $this->targetUrl, 'slug' => $this->slug, 'title' => $this->title ?: null, 'status' => 'active', ]); $this->dispatch('linkCreated'); $this->dispatch('toast', message: 'Link erstellt', type: 'success'); $this->closeModal(); } public function render(): View { return view('livewire.modals.create-link'); } }