- Remove old any-llm related files (Dockerfile, config.yml, web/, setup-laravel.sh) - Update README.md with new Laravel LLM Gateway documentation - Keep docker-compose.yml with laravel-llm container names - Clean project structure for Laravel-only implementation
49 lines
1.2 KiB
PHP
49 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Services\StatisticsService;
|
|
use Illuminate\Http\Request;
|
|
|
|
class DashboardController extends Controller
|
|
{
|
|
public function __construct(
|
|
private StatisticsService $statsService
|
|
) {}
|
|
|
|
/**
|
|
* Display the dashboard
|
|
*/
|
|
public function index()
|
|
{
|
|
$stats = $this->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(),
|
|
]);
|
|
}
|
|
}
|