R2.2: HubPageData - Plan-Katalog + echte Plattform-Kennzahlen fuer die Hub-Landing
Liefert Plan::active(), Einzel-PM-Preis und stuendlich gecachte echte Zahlen (Archiv-Mitteilungen gesamt/je Portal, aktive Newsrooms, Branchen) an web.pressekonto. Tests: Katalog-Preise statt Fake-Liste, keine toten Links/erfundenen Referenzen, Rechtsseiten auf der Hub-Domain erreichbar. (Gehoert zum Web-Commit der Hub-Ueberarbeitung.) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
5226f5de2b
commit
f6edb4aec5
3 changed files with 104 additions and 10 deletions
49
app/Services/Web/HubPageData.php
Normal file
49
app/Services/Web/HubPageData.php
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace App\Services\Web;
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Models\Category;
|
||||
use App\Models\Company;
|
||||
use App\Models\Plan;
|
||||
use App\Models\PressRelease;
|
||||
use App\Scopes\PortalScope;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
/**
|
||||
* Datenaufbereitung der Hub-Landing (pressekonto.de): aktiver Tarif-Katalog
|
||||
* plus echte Plattform-Kennzahlen statt statischer Marketing-Zahlen.
|
||||
*/
|
||||
class HubPageData
|
||||
{
|
||||
private const StatsCacheKey = 'web.hub.landing-stats';
|
||||
|
||||
private const StatsTtlSeconds = 3600;
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function build(): array
|
||||
{
|
||||
return [
|
||||
'plans' => Plan::query()->active()->get(),
|
||||
'singlePmPriceCents' => (int) config('billing.single_pm_price_cents'),
|
||||
'hubStats' => Cache::remember(self::StatsCacheKey, self::StatsTtlSeconds, function (): array {
|
||||
$published = PressRelease::query()
|
||||
->withoutGlobalScope(PortalScope::class)
|
||||
->visibleInArchive();
|
||||
|
||||
return [
|
||||
'releases_total' => (clone $published)->count(),
|
||||
'releases_presseecho' => (clone $published)->forPortalValues([Portal::Presseecho->value, Portal::Both->value])->count(),
|
||||
'releases_businessportal' => (clone $published)->forPortalValues([Portal::Businessportal24->value, Portal::Both->value])->count(),
|
||||
'newsrooms' => Company::query()
|
||||
->withoutGlobalScope(PortalScope::class)
|
||||
->whereHas('pressReleases', fn ($query) => $query->withoutGlobalScope(PortalScope::class)->visibleInArchive())
|
||||
->count(),
|
||||
'categories' => Category::query()->withoutGlobalScope(PortalScope::class)->count(),
|
||||
];
|
||||
}),
|
||||
];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue