Web: Boost-Platzierung auf Start- und Branchenseite ausspielen

Geboostete PMs besetzen Lead- und Top-Slots vor der Chronologie
(HomePageData/CategoryPageData ueber boosted()-Scope) und tragen das
Badge "Top-Platzierung". Abgelaufene Boosts wirken nicht.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-07-10 17:05:10 +00:00
parent 744e87d008
commit bbcdc72e2f
10 changed files with 183 additions and 19 deletions

View file

@ -72,19 +72,37 @@ class HomePageData
->oldest('published_at')
->value('published_at');
$leadRelease = $publishedQuery()
// Gebuchte Boosts (Decision-Update §2.2): geboostete PMs besetzen die
// Top-Positionen vor der Chronologie — die jüngste als Lead, weitere
// in der Seitenleiste. Die Views markieren sie über `boostedIds`.
$boostedReleases = $publishedQuery()
->boosted()
->with($with)
->orderByDesc('published_at')
->first();
->limit(5)
->get();
$boostedIds = $boostedReleases->modelKeys();
$leadRelease = $boostedReleases->first()
?? $publishedQuery()
->with($with)
->orderByDesc('published_at')
->first();
// Ohne mediumText-Spalte `text`: die Seitenleisten-Teaser rendern nur
// Titel/Meta, der Volltext wäre unnötiger I/O.
$sideReleases = $publishedQuery()
->with($with)
->when($leadRelease, fn (Builder $query) => $query->where('id', '!=', $leadRelease->id))
->orderByDesc('published_at')
->limit(4)
->get(['id', 'portal', 'language', 'slug', 'title', 'category_id', 'company_id', 'published_at', 'content_score']);
$sideBoosted = $boostedReleases->slice(1)->take(4)->values();
$sideChronoSlots = 4 - $sideBoosted->count();
$sideReleases = $sideChronoSlots > 0
? $publishedQuery()
->with($with)
->when($leadRelease, fn (Builder $query) => $query->where('id', '!=', $leadRelease->id))
->when($boostedIds !== [], fn (Builder $query) => $query->whereNotIn('id', $boostedIds))
->orderByDesc('published_at')
->limit($sideChronoSlots)
->get(['id', 'portal', 'language', 'slug', 'title', 'category_id', 'company_id', 'published_at', 'content_score'])
: collect();
$sideReleases = $sideBoosted->concat($sideReleases)->values();
$mostReadReleases = $publishedQuery()
->orderByDesc('hits')
@ -244,6 +262,7 @@ class HomePageData
return [
'leadRelease' => $leadRelease,
'sideReleases' => $sideReleases,
'boostedIds' => $boostedIds,
'mostReadReleases' => $mostReadReleases,
'activeNewsrooms' => $activeNewsrooms,
'industryIndex' => $industryIndex,