first commit

This commit is contained in:
2025-11-04 16:23:40 +05:00
commit 6486a35c03
4772 changed files with 506723 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
<?php
namespace App\Http\Controllers;
use App\Models\Category;
use App\Models\Transaction;
use App\Models\User;
use App\Models\Video;
use Carbon\Carbon;
use Illuminate\Support\Facades\Auth;
class StaterkitController extends Controller
{
// home
public function home()
{
$breadcrumbs = [
['link' => "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']);
}
}