<?php

use Livewire\Component;
use App\Models\Inquiry;
use App\Models\Post;
use App\Models\ReporterApplication;
use App\Models\Subscriber;

return new class extends Component
{
    public function render()
    {
        return $this->view()->layout('layouts::auth');
    }

    public function with()
    {
        return [
            'inquiryCount'        => Inquiry::where('status', 'new')->count(),
            'postCount'           => Post::where('status', 'published')->count(),
            'draftCount'          => Post::where('status', 'draft')->count(),
            'totalViews'          => Post::sum('view_count'),
            'newApplications'     => ReporterApplication::where('status', 'pending')->count(),
            'subscriberCount'     => Subscriber::where('status', 'active')->count(),
            'recentInquiries'     => Inquiry::latest()->take(5)->get(),
            'topPosts'            => Post::with('category')->where('status', 'published')->orderBy('view_count', 'desc')->take(5)->get(),
        ];
    }

    protected function view($data = [])
    {
        return app('view')->file('D:\02-my freelance\00-DR_Padhi\DR_PADHI\storage\framework/views/livewire/views/71c289db.blade.php', $data);
    }
};
