feat: make dashboard and sidebar dynamic

This commit is contained in:
2026-08-18 19:49:19 +03:30
parent 8fa9a17ead
commit 0ecdf52c29
5 changed files with 287 additions and 214 deletions
@@ -0,0 +1,26 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\Comment;
use App\Models\Flight;
use App\Models\Tour;
use App\Models\User;
use Illuminate\Http\Request;
class DashboardController extends Controller
{
public function index()
{
$recentComments = Comment::with(['user', 'commentable'])
->latest()
->paginate(5);
$totalUser = User::count();
$totalTours = Tour::count();
$totalFlights = Flight::count();
return view('admin.dashboard', compact('totalUser', 'totalTours', 'totalFlights' , 'recentComments'));
}
}