@extends('layouts.admin.layout')
@section('content')
@include('partials._page_header', [
'pageTitle' => 'Posts',
'addUrl' => url('/admin/post/add'),
'addLabel' => 'Add Post',
])
{{-- Filter bar --}}
@include('partials.message')
| # |
Title |
Category |
Date |
Status |
Actions |
@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
| {{ $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 }}
|
|
@empty
| No posts found. |
@endforelse
{{ $posts->links() }}
@endsection
@push('scripts')
@endpush