"admin/dashboard", 'name' => "Dashboard"] ]; $admin = Auth::user(); $students = User::where('role', 'STUDENT')->count(); $activeStudents = User::where('role', 'STUDENT')->where('status', 1)->count(); $categories = Category::count(); $videos = Video::count(); $credits = Transaction::where('type', 'credit')->whereMonth('created_at', Carbon::now()->month)->sum('amount'); $debits = Transaction::where('type', 'debit')->whereMonth('created_at', Carbon::now()->month)->sum('amount'); $earnings = $credits - $debits; return view('content.home', [ 'breadcrumbs' => $breadcrumbs, 'adminDetails' => $admin, 'students' => $students, 'categories' => $categories, 'videos' => $videos, 'earnings' => $earnings, 'activeStudents' => $activeStudents, ]); } public function toggleTheme() { $theme = session()->has('theme') ? session()->get('theme') : 'light'; if ($theme == 'light') { session()->put('theme', 'dark'); } else { session()->put('theme', 'light'); } return response()->json(['status' => true, 'message' => 'Theme updated in config']); } }