@php $featuredPost = null; $backgroundImage = null; if ($categoryIds && is_array($categoryIds)) { /** @var \Botble\Blog\Models\Post $featuredPost */ $featuredPost = \Botble\Blog\Models\Post::query() ->whereHas('categories', function ($query) use ($categoryIds) { $query->whereIn('id', $categoryIds); }) ->wherePublished() ->latest() ->first(); } @endphp
@if ($featuredPost)
@if (echo_is_video_post($featuredPost) || echo_is_audio_post($featuredPost))
{!! Theme::partial('blog.post.partials.action-post', ['post' => $featuredPost]) !!}
@endif
@endif
@foreach($categories as $category) @php $posts = $category->posts()->whereNot('id', $featuredPost->getKey())->take(3)->with('slugable')->latest()->get(); @endphp @continue($posts->isEmpty())
{{ $category->name }}
@foreach($posts as $post)
{{ RvMedia::image($post->image, $post->name, 'thumb', attributes: ['class' => 'img-hover']) }}
@if ($category = $post->firstCategory) {!! Theme::partial('category-badge', compact('category')) !!} @endif {{ $name }}
@endforeach
@endforeach