@php use App\Models\Publication; $limit = (int) ($block->content['limit'] ?? 6); $heading = $block->content['title'] ?? null; $filterChannelId = $block->content['channel_id'] ?? null; $filterTermId = $block->content['taxonomy_term_id'] ?? null; $query = Publication::published() ->forChannel($filterChannelId ? \App\Models\Channel::find($filterChannelId) ?? $channel : $channel) ->with(['post.author', 'channel.prefixes']) ->latest('published_at'); if ($filterTermId) { $query->whereHas('taxonomyTerms', fn($q) => $q->where('taxonomy_terms.id', $filterTermId)); } $posts = $query->limit($limit)->get(); @endphp @if($posts->isNotEmpty())
{{ $post->title }}
{{ $post->published_at->format('d M Y') }}
@endforeach