authorize('vpn.manage'); // modals are reachable without the route middleware $peer = VpnPeer::query()->with('host')->where('uuid', $uuid)->firstOrFail(); $this->uuid = $uuid; $this->name = $peer->name; $this->hostName = $peer->host?->name; } public function delete(): void { $this->authorize('vpn.manage'); $peer = VpnPeer::query()->where('uuid', $this->uuid)->first(); if ($peer !== null) { // 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'); } }