@extends('layouts.admin.layout') @section('content') @include('partials._page_header', [ 'pageTitle' => 'Posts', 'addUrl' => url('/admin/post/add'), 'addLabel' => 'Add Post', ]) {{-- Filter bar --}}
@if(request('status') || request('category_id')) × Clear @endif
@include('partials.message') @forelse($posts as $post) @php $statusMap = [ 'posted' => ['bg-green-100 text-green-700', 'Published'], 'drafted' => ['bg-gray-100 text-gray-600', 'Draft'], 'pending' => ['bg-yellow-100 text-yellow-700', 'Pending'], 'cancelled' => ['bg-red-100 text-red-600', 'Cancelled'], ]; [$statusClass, $statusLabel] = $statusMap[$post->status] ?? ['bg-gray-100 text-gray-500', ucfirst($post->status)]; @endphp @empty @endforelse
# Title Category Date Status Actions
{{ $posts->firstItem() + $loop->index }} {{ $post->title }} {{ $post->category->name ?? '—' }} {{ $post->post_created_at ? \Carbon\Carbon::parse($post->post_created_at)->format('d M Y') : '—' }} {{ $statusLabel }}
Edit
No posts found.
{{ $posts->links() }}
@endsection @push('scripts') @endpush