['except' => 'all'], ]; public function setTimeframe(string $timeframe): void { $this->timeframe = $timeframe; $this->resetPage(); } public function with(): array { return [ 'releases' => $this->pressReleases(), 'totalCount' => $this->totalCount(), ]; } private function pressReleases(): LengthAwarePaginator { $reference = $this->referenceNow(); return $this->baseQuery() ->when($this->timeframe === 'today', fn (Builder $query) => $query->whereBetween('published_at', [$reference->copy()->startOfDay(), $reference->copy()->endOfDay()])) ->when($this->timeframe === 'week', fn (Builder $query) => $query->where('published_at', '>=', $reference->copy()->subDays(7))) ->orderByDesc('published_at') ->paginate(8); } private function referenceNow(): Carbon { return EditorialClock::reference($this->portalValues(), $this->language); } private function totalCount(): int { return $this->baseQuery()->count(); } private function baseQuery(): Builder { return PressRelease::query() ->with([ 'company', 'category.translations' => fn ($query) => $query->where('locale', $this->language), 'images' => fn ($query) => $query ->orderByDesc('is_preview') ->orderBy('sort_order') ->limit(1), ]) ->whereIn('portal', $this->portalValues()) ->where('status', PressReleaseStatus::Published) ->where('language', $this->language) ->whereNotNull('published_at') ->where('published_at', '<=', now()); } /** * @return array */ private function portalValues(): array { $primary = $this->portal ?? Portal::Businessportal24->value; return [$primary, Portal::Both->value]; } }; ?>

{{ __('web.feed.title') }}


@php $items = $releases->items(); $top = $items[0] ?? null; $rest = array_slice($items, 1); @endphp @if ($top) @else

{{ __('web.feed.empty') }}

@endif @foreach ($rest as $release) @if ($loop->index === 2) {{-- Werbeplatz nach der dritten Feed-Meldung (Position der früheren feed-ad). --}} @endif @endforeach @if ($releases->hasMorePages()) @endif