Add Achievements Controller
parent
6afa5da145
commit
4c76e8dba0
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class AchievementController2 extends Controller
|
||||
{
|
||||
public function showAchievements(){
|
||||
return view('achievements');
|
||||
}
|
||||
public function getAchievements(Request $request)
|
||||
{
|
||||
$username = $request->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.
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue