settings->get('branding.portal_name') ?: self::DEFAULT_NAME; } public function primaryColor(): string { $color = $this->settings->get('branding.primary_color'); return is_string($color) && preg_match('/^#[0-9a-fA-F]{6}$/', $color) ? strtoupper($color) : self::DEFAULT_PRIMARY_COLOR; } public function logoPath(): ?string { return $this->settings->get('branding.logo_path') ?: null; } public function logoUrl(): ?string { $path = $this->logoPath(); return $path ? Storage::disk('uploads')->url($path) : null; } /** * @return array */ public function palette(): array { return ColorPalette::fromHex($this->primaryColor()); } /** * CSS-Variablen für das Portal. Werden serverseitig in die Seite geschrieben – * ohne Build und ohne Farbberechnung im Browser. */ public function cssVariables(): string { $color = $this->primaryColor(); $variables = [ '--brand' => $color, '--brand-foreground' => ColorPalette::foregroundFor($color), ]; foreach ($this->palette() as $shade => $hex) { $variables["--brand-{$shade}"] = $hex; } return collect($variables)->map(fn (string $value, string $name) => "{$name}:{$value}")->implode(';'); } /** * @return array{portal_name: string, primary_color: string, logo_url: string|null} */ public function toArray(): array { return [ 'portal_name' => $this->portalName(), 'primary_color' => $this->primaryColor(), 'logo_url' => $this->logoUrl(), ]; } }