Öffentliche Seiten auf gemeinsames Editorial-Design (x-web.site-header/-footer,
Design-Tokens) und Ausgaben-Präfix /{edition}/ (de|en) umgestellt.
- Routing: neue Middleware SetEdition (Locale + URL::defaults), /{edition}-Gruppe
in routes/web.php, Root-Redirect auf /de, 301 für Legacy-.html-URLs,
Baseline-Default in AppServiceProvider.
- Neue URL-Schemata: /{edition}/press-release/{slug}, /{edition}/category/{slug}.
- Ausgabe = Sprache: DE/EN-Umschalter (Region/CH/AT entfernt); EditorialClock
und Livewire-Komponenten sprachdynamisch.
- Detail-, Kategorie- und Veröffentlichen-Seite mit echten Daten neu aufgebaut.
- Suche aktiviert: Volt-Komponente livewire/web/search (Titel/Text/Keywords +
Firma + Rubrik, Filter, Sortierung, Pagination, URL-Parameter q/category/sort).
- Rubriken-Navigation statt Übersichtsseite: Helper CategoryNavigation;
web/kategorien.blade.php + Route entfernt (Legacy-301).
- Tests: Edition-Routing, Kategorie-Seite/-Navigation, Detail, Veröffentlichen,
Suche, EditorialClock. Doku in "Echte öffentliche Unterseiten.md" aktualisiert.
Co-authored-by: Cursor <cursoragent@cursor.com>
48 lines
1.6 KiB
PHP
48 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Support;
|
|
|
|
use App\Enums\PressReleaseStatus;
|
|
use App\Models\PressRelease;
|
|
use App\Scopes\PortalScope;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
/**
|
|
* Liefert den „Redaktions-Stichtag" für aktualitätsbezogene Startseiten-Abfragen.
|
|
*
|
|
* Das migrierte Archiv ist historisch: Der jüngste veröffentlichte Datensatz
|
|
* kann Wochen/Monate in der Vergangenheit liegen. Würde man „heute / letzte 7
|
|
* Tage" hart gegen das echte now() rechnen, liefern alle Aktualitäts-Module
|
|
* 0 Treffer und fallen auf Mock-Daten zurück.
|
|
*
|
|
* Stattdessen wird der Stichtag an den jüngsten verfügbaren Veröffentlichungs-
|
|
* zeitpunkt gekoppelt (gedeckelt auf now()): Liegt das jüngste published_at in
|
|
* der Vergangenheit, dient es als Referenz-„Jetzt"; sobald frische
|
|
* Pressemitteilungen mit aktuellem Datum einlaufen, greift automatisch wieder
|
|
* das echte now().
|
|
*/
|
|
class EditorialClock
|
|
{
|
|
/**
|
|
* @param array<int, string> $portalValues
|
|
*/
|
|
public static function reference(array $portalValues, string $language = 'de'): Carbon
|
|
{
|
|
$latest = PressRelease::query()
|
|
->withoutGlobalScope(PortalScope::class)
|
|
->whereIn('portal', $portalValues)
|
|
->where('status', PressReleaseStatus::Published)
|
|
->where('language', $language)
|
|
->whereNotNull('published_at')
|
|
->where('published_at', '<=', now())
|
|
->max('published_at');
|
|
|
|
if (! $latest) {
|
|
return now();
|
|
}
|
|
|
|
$latest = Carbon::parse($latest);
|
|
|
|
return $latest->lt(now()) ? $latest : now();
|
|
}
|
|
}
|