llmbackend/app/Services/LogService.php
Jethro Lin 1ab2e796a9 Created missing models:
Admin: For managing administrators with role-based access
LlmProvider: For managing LLM service providers
Created SQL schema:
All tables as per the database design
Proper foreign key constraints and indexes
Timestamps for auditing
Appropriate character sets and collations
Added operation logging:
Created LogService for centralized logging
Integrated logging into TokenService
Logs all token-related operations with user info and IP address
Enhanced token management:
Added comprehensive logging for all token operations
Improved error handling and validation
Added proper cleanup for revoked tokens
2024-12-04 11:31:10 +08:00

22 lines
503 B
PHP

<?php
declare(strict_types=1);
namespace App\Services;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Request;
class LogService
{
public function logOperation(string $userType, int $userId, string $operation): void
{
DB::table('operation_logs')->insert([
'user_type' => $userType,
'user_id' => $userId,
'operation' => $operation,
'ip_address' => Request::ip(),
'created_at' => now(),
]);
}
}