Program::count(), 'active_programs' => Program::where('status', 'published')->count(), 'total_participants' => Participant::count(), 'total_attendances' => Attendance::count(), 'total_certificates' => Certificate::count(), 'generated_certs' => Certificate::whereIn('status', ['generated', 'emailed', 'downloaded'])->count(), 'downloaded_certs' => Certificate::where('status', 'downloaded')->count(), 'total_responses' => QuestionnaireResponse::count(), 'pending_emails' => EmailLog::where('status', 'pending')->count(), ]; $recentPrograms = Program::with('creator') ->latest() ->limit(5) ->get(); return view('admin.dashboard', compact('stats', 'recentPrograms')); } }