deletionRequest = AccountDeletionRequest::query() ->where('user_id', $user->getKey()) ->latest() ->first(); $this->activePin = SupportPin::query() ->where('user_id', $user->getKey()) ->whereNull('revoked_at') ->where('expires_at', '>', now()) ->latest() ->first(); } public function render() { return view('compliance-tools::client.privacy-center')->layoutData([ 'sidebar' => true, 'title' => Lang::get('compliance-tools::client.title'), ]); } public function submitDeletionRequest(AccountDeletionService $service): void { if ($this->deletionRequest && $this->deletionRequest->status === AccountDeletionRequest::STATUS_PENDING) { $this->notify(Lang::get('compliance-tools::client.deletion_request_exists'), 'warning'); return; } $user = Auth::user(); $this->deletionRequest = $service->submit($user, $this->reason, [ 'ip_address' => request()->ip(), 'user_agent' => request()->userAgent(), ]); $this->reason = ''; $this->notify(Lang::get('compliance-tools::client.deletion_requested')); } public function generatePin(SupportPinService $service): void { $user = Auth::user(); [$pin, $plain] = $service->generate($user); $this->activePin = $pin; $this->generatedPin = $plain; $this->showGeneratedPin = false; $this->notify(Lang::get('compliance-tools::client.pin_generated')); } public function revokePin(SupportPinService $service): void { if (!$this->activePin) { return; } $service->revoke($this->activePin, Auth::user()); $this->activePin = null; $this->generatedPin = null; $this->showGeneratedPin = false; $this->notify(Lang::get('compliance-tools::client.pin_revoked')); } public function toggleGeneratedPinVisibility(): void { if (!$this->generatedPin) { return; } $this->showGeneratedPin = !$this->showGeneratedPin; } public function pinCopied(): void { if (!$this->generatedPin) { return; } $this->notify(Lang::get('compliance-tools::client.pin_copied')); } }