@extends('admin.layouts.app') @section('title', 'Posts Management') @section('content')

Posts Management

Manage and moderate Connect posts

Manage Categories

Total Posts

{{ number_format($stats['total_posts']) }}

{{ number_format($stats['posts_today']) }} today

This Week

{{ number_format($stats['posts_this_week']) }}

{{ number_format($stats['posts_this_month']) }} this month

Total Engagement

{{ number_format($stats['total_engagement']) }}

Avg: {{ number_format($stats['avg_engagement'], 1) }}

High Engagement

{{ $posts->where('engagement_score', '>=', 100)->count() }}

Score ≥ 100

Clear Filters
@csrf @php $headers = [ ['label' => '', 'class' => 'w-12'], ['label' => 'Author', 'class' => ''], ['label' => 'Post', 'class' => ''], ['label' => 'Category', 'class' => 'w-36'], ['label' => 'Engagement', 'class' => 'w-40'], ['label' => 'Date', 'class' => 'w-36'], ['label' => 'Actions', 'class' => 'text-right w-28'], ]; $rows = []; foreach($posts as $post) { $engagementClass = 'border-l-0'; if ($post->engagement_score >= 100) $engagementClass = 'border-l-4 border-orange-400'; else if ($post->engagement_score >= 50) $engagementClass = 'border-l-4 border-purple-400'; else if ($post->engagement_score > 0) $engagementClass = 'border-l-4 border-sky-400'; $cells = []; $cells[] = ['content' => '', 'class' => '']; $authorHtml = '
' . e(strtoupper(substr($post->author->name ?? 'N', 0, 2))) . '

' . e($post->author->name ?? 'Unknown') . '

' . e($post->author->email ?? 'N/A') . '

'; $cells[] = ['content' => $authorHtml, 'class' => '']; $postHtml = '

' . e(Str::limit($post->body, 100)) . '

' . ($post->image_url ? ' Has image' : '') . ($post->specialty_tag ? ' ' . e($post->specialty_tag) . '' : '') . '
'; $cells[] = ['content' => $postHtml, 'class' => '']; $cells[] = ['content' => '' . e($post->category->name ?? 'Uncategorized') . '', 'class' => '']; $engHtml = '
❤️ ' . $post->likes_count . '💬 ' . $post->comments_count . '🔁 ' . $post->reposts_count . '
Score: ' . number_format($post->engagement_score, 1) . '' . ($post->signal_level ? 'Signal: L' . $post->signal_level . '' : '') . '
'; $cells[] = ['content' => $engHtml, 'class' => '']; $cells[] = ['content' => '

' . e($post->created_at->format('M d, Y')) . '

' . e($post->created_at->format('h:i A')) . '

', 'class' => '']; $actionHtml = '
'; $actionHtml .= '' . csrf_field() . method_field('DELETE') . ''; $actionHtml .= '
'; $cells[] = ['content' => $actionHtml, 'class' => 'text-right']; $rows[] = ['cells' => $cells, 'class' => $engagementClass]; } @endphp @include('admin.components.table_shell', [ 'headers' => $headers, 'rows' => $rows, 'emptyMessage' => 'No posts found', 'pagination' => $posts ])
{{ $posts->links() }}
@endif
@push('scripts') @push('scripts') @endpush @endsection