@extends('layouts.main')

@section('content')
    <div class="container mt-5">
        <h1 class="mt-4 mb-4">Blog</h1>
        <div>
            @forelse ($blogs as $blog)
                <div class="row mb-4">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-body">
                                <h5 class="card-title">{{ $blog->title }}</h5>
                                <p class="card-text">
                                    {{ $blog->description }}
                                </p>
                                <a href="{{ url('/blog/' . $blog->slug) }}" class="btn btn-primary">Read</a>
                            </div>
                            <div class="card-footer text-muted">
                                {{ $blog->created_at->format('F d, Y') }}
                            </div>
                        </div>
                    </div>
                </div>
            @empty
                <p class="text-center">No blogs available.</p>
            @endforelse
        </div>
    </div>
@endsection
