Files
ABSDEV/resources/themes/saasland/views/views/documents/news-feed.blade.php
T
2026-07-27 11:45:03 +01:00

35 lines
1.9 KiB
PHP

@if ((bool) ($data['enabled'] ?? true))
@php
$includeIds = collect(explode(',', (string) ($data['include_ids'] ?? '')))->map(static fn ($id) => (int) trim($id))->filter();
$excludeIds = collect(explode(',', (string) ($data['exclude_ids'] ?? '')))->map(static fn ($id) => (int) trim($id))->filter();
$items = collect(${latestNewsArticles} ?? [])
->when($includeIds->isNotEmpty(), static fn ($collection) => $collection->filter(static fn ($item) => $includeIds->contains((int) $item->id)))
->reject(static fn ($item) => $excludeIds->contains((int) $item->id))
->take(max(1, (int) ($data['limit'] ?? 3)));
@endphp
@if ($items->isNotEmpty())
<section class="section">
<div class="wrap">
<div class="heading">
@if (filled($data['eyebrow'] ?? null))<span>{{ $data['eyebrow'] }}</span>@endif
@if (filled($data['heading'] ?? null))<h2>{{ $data['heading'] }}</h2>@endif
@if (filled($data['description'] ?? null))<p>{{ $data['description'] }}</p>@endif
</div>
<div class="grid three">
@foreach ($items as $article)
<article class="card">
@if ($article->published_at)<b>{{ optional($article->published_at)->format('d M Y') }}</b>@endif
<h3>{{ $article->title }}</h3>
@if (filled($article->excerpt))<p>{{ $article->excerpt }}</p>@endif
@if (Route::has('news.public.show'))
<a class="read-more" href="{{ route('news.public.show', $article->slug) }}">Read update →</a>
@endif
</article>
@endforeach
</div>
</div>
</section>
@endif
@endif