@php // Blog modelinden published içerikleri çek $blogs = \App\Models\Blog::with(['category', 'author']) ->withCount('comments') ->published() ->latest('published_at') ->limit(6) ->get(); @endphp
@if($blogs->count() > 0)
@foreach($blogs as $blog) @php $title = method_exists($blog, 'translate') ? $blog->translate('title') : $blog->title; $excerpt = method_exists($blog, 'translate') ? $blog->translate('excerpt') : ($blog->excerpt ?? ''); $categoryName = $blog->category ? ($blog->category->name ?? '') : ''; $publishedDate = $blog->published_at ? $blog->published_at->format('d M Y') : ''; $imageUrl = $blog->featured_image ? asset('storage/' . $blog->featured_image) : asset('assets/img/photos/b4.jpg'); $blogUrl = route('blog.show', $blog->slug); $commentCount = $blog->comments_count ?? 0; @endphp
@endforeach
@else

{{ __('blog.empty', ['default' => 'No blog posts available at the moment.']) }}

@endif