with('host')->where('uuid', $uuid)->firstOrFail(); $this->authorize('delete', $peer); $this->uuid = $uuid; $this->name = $peer->name; $this->hostName = $peer->host?->name; } public function delete(): void { $peer = VpnPeer::query()->where('uuid', $this->uuid)->first(); if ($peer !== null) { $this->authorize('delete', $peer); // A tombstone that still carries a usable private key is a liability. $peer->purgeSecret(); // Soft-delete, so the row survives as a tombstone until the hub has // actually dropped the peer. A hard delete here would let the next // sync adopt the still-present peer back as a live access — // silently restoring what was just revoked. ApplyVpnPeer purges the // tombstone once removal succeeded; SyncVpnPeers retries if not. $peer->delete(); ApplyVpnPeer::dispatch($peer->public_key, null, false); } $this->dispatch('vpn-peer-deleted'); $this->closeModal(); } public function render() { return view('livewire.admin.confirm-delete-vpn-peer'); } }