show('privacy'); } public function cookies(): View { return $this->show('cookies'); } public function terms(): View { return $this->show('terms'); } private function show(string $type): View { abort_unless(in_array($type, ['privacy', 'cookies', 'terms'], true), 404); $document = LegalDocument::query() ->where('type', $type) ->where('status', 'published') ->where(fn ($query) => $query->whereNull('published_at')->orWhere('published_at', '<=', now())) ->latest('published_at') ->latest('updated_at') ->first(); $fallbacks = [ 'privacy' => ['Privacy Policy', 'BeatBook is designed for UK GDPR compliance, data minimisation, access/export and deletion workflows. A published privacy policy can be maintained from the administration area.'], 'cookies' => ['Cookie Policy', 'Necessary cookies operate the service. Analytics and marketing cookies require consent. A published cookie policy can be maintained from the administration area.'], 'terms' => ['Terms of Service', 'Marketplace, DJ, client, cancellation, payment, refund and acceptable-use terms can be maintained from the administration area.'], ]; [$fallbackTitle, $fallbackBody] = $fallbacks[$type]; return view('legal.page', compact('document', 'fallbackTitle', 'fallbackBody', 'type')); } }