I've literally just created a new project and made a single route:
Route::get('/getSummoner', 'RiotController@getSummoner');
That executes this function:
public function getSummoner(){
$get = file_get_contents("https://na1.api.riotgames.com/lol/summoner/v4/summoners/by-name/RiotSchmick?api_key=");
$result = json_decode($get);
return response()->json([
'result' => $result,
], 201);
}
and on the front-end, I get the following error:
Access to XMLHttpRequest at 'url' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I understand this happens when the I make a request to a different domain than what my page is on but since the API is not mine, I can't really make a request from the same domain, can I?