<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class PpidDashboardController extends Controller
{
    public function index()
    {
        // Hitung statistik dari database
        $stats = [
            'total_informasi' => DB::table('informasi_publik')
                ->where('is_published', true)
                ->count(),

            'total_permohonan' => DB::table('permohonan_informasi')->count(),

            'permohonan_ditindaklanjuti' => DB::table('permohonan_informasi')
                ->whereIn('status', ['diproses', 'disetujui', 'ditolak'])
                ->count(),

            'keberatan' => DB::table('permohonan_informasi')
                ->where('status', 'keberatan')
                ->count()
        ];

        return view('ppid.dashboard', compact('stats'));
    }
}