<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Models\VPengusul;
use Illuminate\Support\Facades\DB;

class DashboardController extends Controller
{

    public function index() {
        $data['jumlah'] = DB::table("tr_pengajuan")
                ->select("id_kategori", DB::raw("count (id_kategori) as jumlah"))
                ->groupBy("id_kategori")
                ->pluck('jumlah','id_kategori');

        $semua = VPengusul::count();
        $sudah = DB::table('tr_pengajuan')->count();

        $data['sudah'] = $sudah;
        $data['belum'] = $semua-$sudah;

        return view('dashboard',$data);
    }
}
