@php $limit = (int) ($section->settings['limit'] ?? 3); $posts = \App\Models\Post::where('status', 'published') ->orderBy('published_at', 'desc') ->limit($limit) ->get(); $title = $section->settings['title'] ?? 'Latest From Our Blog'; $subtitle = $section->settings['subtitle'] ?? 'Stay updated with the latest news, tutorials and community highlights.'; $show_date = $section->settings['show_date'] ?? true; $show_author = $section->settings['show_author'] ?? true; // Theme integration $activeTheme = \App\Services\ThemeManager::getActiveTheme(); $themeSettings = \App\Models\ThemeSetting::where('theme_slug', $activeTheme)->first(); $primaryColor = $themeSettings->primary_brand_color ?? '#6366f1'; $cardBg = $themeSettings->component_bg_color ?? '#ffffff'; $textColor = $themeSettings->primary_text_color ?? '#0f172a'; $textMuted = $themeSettings->secondary_text_color ?? '#64748b'; // Compact Grid Logic $count = $posts->count(); $gridClass = "grid grid-cols-1 gap-8 "; if($count === 1) { $gridClass = "flex justify-center"; $cardWidth = "max-w-sm w-full"; // Significantly smaller } elseif($count === 2) { $gridClass .= "md:grid-cols-2 max-w-4xl mx-auto"; $cardWidth = "w-full"; } else { $gridClass .= "md:grid-cols-2 lg:grid-cols-" . ($limit >= 4 ? 4 : 3); $cardWidth = "w-full"; } @endphp
@if(!empty($section->settings['badge'])) {{ $section->settings['badge'] }} @endif

{!! nl2br(e($title)) !!}

@if(!empty($subtitle))

{{ $subtitle }}

@endif
@if($count > 0)
@foreach($posts as $post)
@php $imgUrl = $post->featured_image; if ($imgUrl && !str_starts_with($imgUrl, 'http')) { $imgUrl = \Illuminate\Support\Facades\Storage::url($imgUrl); } @endphp @if($imgUrl) {{ $post->title }} @endif {{-- Placeholder State --}}
Visuals Pending
@if($post->category)
{{ $post->category->name }}
@endif
@if($show_date)
{{ $post->published_at ? $post->published_at->format('M d, Y') : $post->created_at->format('M d, Y') }}
@endif @if($show_author && $post->author)
{{ $post->author->name }}
@endif

{{ $post->title }}

{{ $post->excerpt ?: Str::limit(strip_tags($post->content), 120) }}

Explore Story
@endforeach
@else

No blog posts found

Start sharing your thoughts with the world!

@endif