@extends('layouts.admin') @section('title', __('Blog')) @section('page-title', __('Blog')) @section('content')
{{ __('Search') }}
@admincan('admin.blog_posts.create') {{ __('Create Post') }} @endadmincan
@forelse($posts as $post) @empty @endforelse
{{ __('Title') }} {{ __('Slug') }} {{ __('Status') }} {{ __('When') }} {{ __('Actions') }}
@if($post->status === 'publish' && $post->published_at && $post->published_at->lessThanOrEqualTo(now())) {{ $post->title }} @else {{ $post->title }} @endif {{ $post->slug }} @php $statusColors = [ 'publish' => 'bg-green-100 text-green-800', 'draft' => 'bg-gray-100 text-gray-800', 'schedule' => 'bg-yellow-100 text-yellow-800', ]; $statusLabel = [ 'publish' => __('Published'), 'draft' => __('Draft'), 'schedule' => __('Scheduled'), ]; @endphp {{ $statusLabel[$post->status] ?? ucfirst((string) $post->status) }} @if($post->status === 'schedule') {{ $post->scheduled_at ? $post->scheduled_at->format('M d, Y H:i') : '—' }} @else {{ $post->published_at ? $post->published_at->format('M d, Y') : '—' }} @endif
@if($post->status === 'publish' && $post->published_at && $post->published_at->lessThanOrEqualTo(now())) {{ __('View') }} @endif @admincan('admin.blog_posts.edit') {{ __('Edit') }} @endadmincan @if($post->is_published) @admincan('admin.blog_posts.edit')
@csrf {{ __('Unpublish') }}
@endadmincan @else @admincan('admin.blog_posts.edit')
@csrf {{ __('Publish') }}
@endadmincan @endif @admincan('admin.blog_posts.delete')
@csrf @method('DELETE') {{ __('Delete') }}
@endadmincan
{{ __('No posts found.') }}
@if($posts->hasPages())
{{ $posts->links() }}
@endif
@endsection