Quoting through a nested array in a Laravel Blade template

I have the following code:

@foreach($data['daily'] as $date => $dailyData) <tr> <td>{{$date}}</td> @foreach($dailyData as $key => $value) <td> <span>{{$value}}</span> <strong>{{$data['another_index'][$date][$key]}}</strong> </td> @endforeach </tr> @endforeach 

This returns me an error

 [ErrorException] Undefined index: date 

When the code is executed. Actually, I have values ​​in another_index and I can print it.

Thanks in advance for your help.

 [another_index] => Array ( [2016-03-15] => Array ( [key] => 100.00% [key1] => 0.00% [key2] => 0.00% ) [2016-03-14] => Array ( [key] => 10.00% [key1] => 20.00% [key2] => 30.00% ) 
+5
source share
1 answer

Looking at your array of samples, this should give you what you are trying to achieve:

 @foreach($data as $date => $dailyData) <tr> <td>{{$date}}</td> @foreach($dailyData as $key => $value) <td> <span>{{$key}}</span> <strong>{{$value}}</strong> </td> @endforeach </tr> @endforeach 
0
source

Source: https://habr.com/ru/post/1245100/


All Articles