I can't do a foreach with my response
I already tried many things but nothing resolved it
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index()
{
$client = new \GuzzleHttp\Client();
$effects = [];
$res = $client->request('GET', 'http://85.171.71.189/get_modes');
$effects = json_decode($res->getBody()->getContents(), true);
return view('base.effects', [ 'effects' => $effects ]);
}
@if($effects)
@foreach($effects as $effect)
<tr>
<td>{{ $effect['mode'] }}</td>
<td>{{ $effect['name'] }}</td>
<td><button class="btn btn-sm btn-primary">Activate</button></td>
<tr>
@endforeach
@else
<tr>
<td colspan="3">No effects found.</td>
</tr>
@endif
I expect that I have a table with all modes inside, but the actual error is
Undefined index: name (View: H:\wamp64\www\scintillement\resources\themes\light\base\effects.blade.php)