<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
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 = DB::table('bantuan_pengusul')->count();
        $sudah = DB::table('tr_pengajuan')->count();

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

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