presseportale/app/Support/WebPortalContext.php
Kevin Adametz b3474a36e9 Spoke-Frontend-Audit: Fake-Inhalte raus, Newsletter-Rueckbau, echte Boersendaten, EN-Lokalisierung
Frontend-Umbau (Kevin, 06.07.2026), Ergebnis des businessportal24-Audits:

- Fake-Anzeigen und Mock-/Fallback-Daten entfernt (focus-ad, feed-ad,
  highlight-card, press-release-card, featured-releases, press-releases-grid);
  Sektionen rendern nur noch mit echten Daten oder gar nicht
- Newsletter-Strip und Newsletter-Box zurueckgebaut (Feature nachgelagert,
  vor Reaktivierung DOI-Flow noetig)
- Echte Boersendaten: MarketDataService (Yahoo-Finance-Quotes, config/market.php,
  Cache) + market:refresh alle 15 Min. im Scheduler; live-ticker blendet sich
  ohne Daten aus
- EN-Lokalisierung der Kern-Seiten via lang/de/web.php + lang/en/web.php;
  Carbon-Locale folgt app()->getLocale()
- Web-Tests auf den neuen Frontend-Stand nachgezogen (Suite: 993 gruen)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 13:36:23 +00:00

50 lines
1.5 KiB
PHP

<?php
namespace App\Support;
use App\Enums\Portal;
/**
* Öffentlicher Portal-Kontext (Presseecho/Businessportal24) einer Web-Landingpage,
* abgeleitet aus dem Host. Bündelt die zuvor in jeder Route-Closure wiederholte
* Host→Portal-Ableitung samt Anwendung der Domain-/Theme-Konfiguration.
*/
class WebPortalContext
{
/**
* @param list<string> $portalValues Eigenes Portal plus `both`.
* @param array<string, mixed> $domainConfig
*/
private function __construct(
public readonly string $domainKey,
public readonly Portal $portal,
public readonly string $language,
public readonly array $portalValues,
public readonly array $domainConfig,
) {}
/**
* Portal-Ableitung ohne Seiteneffekte (kein Anwenden der Domain-Config) —
* für Komponenten, die nur wissen müssen, auf welchem Portal sie rendern.
*/
public static function portalFromHost(): Portal
{
return str_contains(request()->getHost(), 'presseecho')
? Portal::Presseecho
: Portal::Businessportal24;
}
public static function fromRequest(): self
{
$portal = self::portalFromHost();
$domainKey = $portal === Portal::Presseecho ? 'presseecho' : 'businessportal24';
return new self(
domainKey: $domainKey,
portal: $portal,
language: app()->getLocale(),
portalValues: [$portal->value, Portal::Both->value],
domainConfig: DomainAssetContext::applyWebDomainConfig($domainKey),
);
}
}