add config file portal to fix env error maybe

This commit is contained in:
2020-04-04 11:19:30 +02:00
parent bf67d4d2d1
commit 9c6c771171
2 changed files with 6 additions and 1 deletions

View File

@@ -9,7 +9,7 @@ class MeteoController extends Controller
public function index() public function index()
{ {
$idCity = 2995971; $idCity = 2995971;
$apiKey = env('OPEN_WEATHER_MAP_API_KEY', ''); $apiKey = config('portal.open_weather_map_api_key');
$params = '&units=metric&lang=fr'; $params = '&units=metric&lang=fr';
$url = 'https://api.openweathermap.org/data/2.5/forecast?id='.$idCity.'&appid='.$apiKey.$params; $url = 'https://api.openweathermap.org/data/2.5/forecast?id='.$idCity.'&appid='.$apiKey.$params;
$client = new \GuzzleHttp\Client(); $client = new \GuzzleHttp\Client();

5
config/portal.php Normal file
View File

@@ -0,0 +1,5 @@
<?php
return [
'open_weather_map_api_key' => env('OPEN_WEATHER_MAP_API_KEY'),
];