fixed main frontend
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
@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
|
||||
Reference in New Issue
Block a user