firstOrFail(); $this->authorizeWorkspace($domain->workspace_id); $this->workspaceId = $domain->workspace_id; $this->domainId = $domainId; $this->hostname = $domain->hostname; $this->verificationToken = $domain->verification_token; } public function verify(): void { $domain = Domain::where('id', $this->domainId) ->where('workspace_id', $this->workspaceId) ->firstOrFail(); $verified = (new VerifyDomainAction)->handle($domain); if ($verified) { $this->dispatch('domainVerified', domainId: $this->domainId); $this->dispatch('toast', message: 'Domain verifiziert', type: 'success'); $this->closeModal(); } else { $this->dispatch('toast', message: 'DNS-Eintrag nicht gefunden. Bitte warten und erneut versuchen.', type: 'error'); } } public static function modalMaxWidth(): string { return 'md'; } public function render(): View { return view('livewire.modals.verify-domain'); } private function authorizeWorkspace(int $workspaceId): void { Workspace::where('id', $workspaceId) ->where(fn ($q) => $q ->where('owner_id', auth()->id()) ->orWhereHas('members', fn ($q) => $q->where('user_id', auth()->id())) )->firstOrFail(); } }