@extends('admin.layouts.app') @section('title', 'Blog Posts') @section('page-title', 'Blog Posts') @section('content') {{-- Page Header with Actions --}}

Blog Posts

Manage all your blog content and SEO settings

Add New Post
{{-- Stats Summary --}}

Total Posts

{{ $blogs->total() }}

Published

{{ \App\Models\Blog::where('is_published', true)->count() }}

Drafts

{{ \App\Models\Blog::where('is_published', false)->count() }}

{{-- Search & Filter Bar --}}
@if(request('search') || request('status')) Clear @endif
{{-- Blog Table --}} @if($blogs->isEmpty())

No blog posts found

Get started by creating your first blog post.

Create Your First Post
@else
{{-- Table --}}
@foreach($blogs as $blog) {{-- Post Info --}} {{-- Status --}} {{-- Author --}} {{-- Date --}} {{-- Actions --}} @endforeach
Post Status Author Date Actions
{{-- Featured Image --}} @if($blog->featured_image && file_exists(public_path('uploads/blogs/'.$blog->featured_image))) {{ $blog->title }} @else
@endif {{-- Title & Slug --}}

{{ $blog->title }}

/blog/{{ $blog->slug }}

@if($blog->excerpt)

{{ Str::limit($blog->excerpt, 60) }}

@endif
@if($blog->is_published) Published @else Draft @endif
{{ strtoupper(substr($blog->author->name ?? 'A', 0, 1)) }}
{{ $blog->author->name ?? 'Unknown' }}
{{ $blog->created_at->format('M d, Y') }}
{{ $blog->created_at->format('h:i A') }}
{{-- View (if published) --}} @if($blog->is_published) @endif {{-- Edit --}} {{-- Delete --}}
@csrf @method('DELETE')
{{-- Pagination --}} @if($blogs->hasPages())
{{ $blogs->links() }}
@endif
@endif @endsection