enforce(RateLimiter::identifier(), 'api'); // 2. JWT Authentication $jwtService = new JwtService($redis); $decoded = $jwtService->authenticate(); // متغيرات مساعدة للمطور $user_id = $decoded->user_id ?? null; $role = $decoded->role ?? 'passenger'; // 3. Database Connection try { $con = Database::get('main'); } catch (Exception $e) { http_response_code(500); exit(json_encode(['error' => 'Database connection failed'])); }