Core Features: - Multi-provider support (OpenAI, Anthropic, DeepSeek, Gemini, Mistral) - Provider service architecture with abstract base class - Dynamic model discovery from provider APIs - Encrypted per-user provider credentials storage Admin Interface: - Complete admin panel with Livewire components - User management with CRUD operations - API key management with testing capabilities - Budget system with limits and reset schedules - Usage logs with filtering and CSV export - Model pricing management with cost calculator - Dashboard with Chart.js visualizations Database Schema: - MariaDB migrations for all tables - User provider credentials (encrypted) - LLM request logging - Budget tracking and rate limiting - Model pricing configuration API Implementation: - OpenAI-compatible endpoints - Budget checking middleware - Rate limit enforcement - Request logging jobs - Cost calculation service Testing: - Unit tests for all provider services - Provider factory tests - Cost calculator tests Documentation: - Admin user seeder - Model pricing seeder - Configuration files
37 lines
1.0 KiB
PHP
37 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\User;
|
|
use Illuminate\Http\Request;
|
|
|
|
class UserManagementController extends Controller
|
|
{
|
|
/**
|
|
* Display a listing of users with budget info
|
|
*/
|
|
public function index(Request $request)
|
|
{
|
|
$query = User::with(['budget', 'rateLimit', 'llmRequests'])
|
|
->withCount('llmRequests');
|
|
|
|
// Search
|
|
if ($request->has('search') && $request->search) {
|
|
$query->where(function ($q) use ($request) {
|
|
$q->where('name', 'like', '%' . $request->search . '%')
|
|
->orWhere('email', 'like', '%' . $request->search . '%');
|
|
});
|
|
}
|
|
|
|
// Sort
|
|
$sortBy = $request->get('sort_by', 'created_at');
|
|
$sortOrder = $request->get('sort_order', 'desc');
|
|
$query->orderBy($sortBy, $sortOrder);
|
|
|
|
$users = $query->paginate(20)->withQueryString();
|
|
|
|
return view('admin.users.index', compact('users'));
|
|
}
|
|
}
|