where('workspace_id', $workspace->id) ->firstOrFail(); $this->qrUlid = $qrUlid; $this->url = $qr->payload['url'] ?? ''; $this->label = $qr->label ?? ''; $this->type = $qr->type; } protected function rules(): array { return [ 'url' => 'required|url|max:2048', 'label' => 'nullable|max:200', 'type' => 'required|in:url,vcard,wifi,pdf,mp3,text', ]; } public function save(): void { $this->validate(); $workspace = app('current_workspace'); $qr = QrCode::where('ulid', $this->qrUlid) ->where('workspace_id', $workspace->id) ->firstOrFail(); $qr->update([ 'type' => $this->type, 'payload' => ['url' => $this->url], ]); $this->dispatch('qrUpdated', qrUlid: $this->qrUlid); $this->dispatch('toast', message: 'QR Code aktualisiert', type: 'success'); $this->closeModal(); } public static function modalMaxWidth(): string { return 'md'; } public function render(): View { return view('livewire.modals.edit-qr-code'); } }