From 4c76e8dba06ceb26b2cf62f780a7566634bbffaf Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 5 Jun 2023 21:43:26 +0200 Subject: [PATCH] Add Achievements Controller --- .../Controllers/AchievementController.php | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 app/Http/Controllers/AchievementController.php diff --git a/app/Http/Controllers/AchievementController.php b/app/Http/Controllers/AchievementController.php new file mode 100644 index 0000000..6a50ee7 --- /dev/null +++ b/app/Http/Controllers/AchievementController.php @@ -0,0 +1,39 @@ +input('username'); + $gameId = $request->input('game_id'); + $apiKey = 'nEkCuLsy6N2PZeiAAiUQ2oqqWOHXfrzP'; + + $apiUrl = 'https://retroachievements.org/API/API_GetGameInfoAndUserProgress.php'; + + // Make the API request using Axios or any other JavaScript-based HTTP client + // You can pass additional parameters or headers as needed + $response = Http::get($apiUrl, [ + 'webApiKey ' => $apiKey, + 'userName ' => $username, + 'gameId' => $gameId, + ]); + + return $response->json(); + + // Process the response + // ... + + // Return the processed response + // ... + + // You can store the processed response in the database, display it in a view, or return it as a JSON response. + } +}