where('owner_id', auth()->id()) ->firstOrFail(); $this->workspaceUlid = $workspaceUlid; $this->workspaceName = $workspace->name; } /** @return array */ protected function rules(): array { return [ 'confirmation' => 'required|in:'.$this->workspaceName, ]; } /** @return array */ protected function messages(): array { return [ 'confirmation.in' => 'Please type the workspace name exactly to confirm.', ]; } public function delete(): void { $this->validate(); Workspace::where('ulid', $this->workspaceUlid) ->where('owner_id', auth()->id()) ->firstOrFail() ->delete(); $this->dispatch('workspaceDeleted', workspaceUlid: $this->workspaceUlid); $this->closeModal(); } public static function closeModalOnClickAway(): bool { return false; } public function render(): View { return view('livewire.modals.delete-workspace'); } }