<?php 

namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Guru;
use App\Models\Siswa;
use App\Models\Kelas;
use App\Models\Mapel;
use App\Models\Challenge;
use Illuminate\Support\Facades\Auth;

class AdminController extends Controller {
    public function dashboard(){
        $totalGuru = Guru::count();
        $totalSiswa = Siswa::count();
        $totalKelas = Kelas::count();
        $totalMapel = Mapel::count();
        $chartData = Kelas::withCount('siswa')->get();
        $latestChallenges = Challenge::latest()->take(3)->get();
        return view('admin.dashboard', compact('totalGuru','totalSiswa','totalKelas','totalMapel','chartData','latestChallenges'));
    }
}
