env('API_FOOTBALL_KEY'), ]) ->withoutVerifying() // 临时跳过 SSL 验证 ->get(env('API_FOOTBALL_HOST') . '/' . $endpoint, $params); if ($response->successful()) { return $response->json(); } // Handle errors as needed throw new \Exception("API request failed: " . $response->body()); } public static function post($endpoint, $data = []) { $response = Http::withHeaders([ 'x-apisports-key' => config('services.api_football.key'), ])->post(config('services.api_football.host') . '/' . $endpoint, $data); if ($response->successful()) { return $response->json(); } // Handle errors as needed throw new \Exception("API request failed: " . $response->body()); } // 时区 public static function timezone() { return self::get('timezone'); } // 国家/地区 public static function countries($params = []) { return self::get('countries', $params); } // 联赛 获取可用的联赛和杯赛名单。 public static function leagues($params = []) { return static::get('leagues', $params); } // 联赛赛季 获取特定联赛的赛季列表。 public static function leaguesSeasons($params = []) { return static::get('leagues/seasons', $params); } // This endpoint returns in-play odds for fixtures in progress. // 此端点会返回正在进行的比赛的实时赔率。 // Update Frequency : This endpoint is updated every 5 seconds. // 更新频率:此端点每 5 秒钟更新一次。 public static function oddsLive($params = []) { return static::get('odds/live', $params); } public static function odds($params = []) { return static::get('odds', $params); } public static function fixturesRounds($params = []) { return static::get('fixtures/rounds', $params); } // 赛程 public static function fixtures($params = []) { return self::get('fixtures', $params); } }