statsService->getDashboardStats(); $dailyUsage = $this->statsService->getDailyUsageChart(30); $topUsers = $this->statsService->getTopUsers(5); $providerStats = $this->statsService->getUsageByProvider(30); $modelStats = $this->statsService->getUsageByModel(30); $costTrends = $this->statsService->getCostTrends(30); $errorStats = $this->statsService->getErrorStats(30); return view('dashboard', compact( 'stats', 'dailyUsage', 'topUsers', 'providerStats', 'modelStats', 'costTrends', 'errorStats' )); } /** * Get real-time stats via AJAX */ public function realtimeStats() { return response()->json([ 'stats' => $this->statsService->getDashboardStats(), 'timestamp' => now()->toIso8601String(), ]); } }