I'm trying to show JSON data from this https://pomber.github.io/covid19/timeseries.json, but I got an error:
(ErrorException(code: 0): Undefined index: confirmed
What I expect is I can show the list of Country Name following with the Date, Confirmed, etc.
Here's my view:
@foreach($results as $json_d)
{{ $json_d['date'] }}
{{ $json_d['confirmed'] }}
{{ $json_d['deaths'] }}
{{ $json_d['recovered'] }}
@endforeach
And here's my controller:
$client = new Client();
$request = $client->get('https://pomber.github.io/covid19/timeseries.json');
$response = $request->getBody()->getContents();
$results = json_decode($response, true);
return view('dashboard', compact('results'));
Any help would be appreciated :)
confirmedthe only index with the warning and the others are fine?