Looping through nested array in Laravel Blade template

Viewed 2193

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 is returning me an error

[ErrorException]
Undefined index: date

When the code is executed. Actually I have values there in another_index and I am able to print it.

Thanks in advance for the 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%
                )
1 Answers
Related