I'm trying to foreach
my arrays but not working
this is my Controller
$start = (new DateTime("2016-11-01"))->modify('first day of this month');
$end = (new DateTime("2017-02-01"))->modify('first day of next month');
$interval = DateInterval::createFromDateString('1 month');
$period = new DatePeriod($start, $interval, $end);
$result = array();
foreach ($period as $dt) {
$data_month = array(
'month' => $dt->format("n"),
'year' => $dt->format("Y")
);
array_push($result, $data_month);
}
and this is my blade
@foreach($result as $row => $innerArray)
@foreach($innerArray as $innerRow => $value)
<td>{{$value->month}}</td>
<td>{{$value->year}</td>
@endforeach
@endforeach
result:
Trying to get property of non-object
but if I try like this just only first value on the array ('month') are looping
@foreach($result as $row => $innerArray)
@foreach($innerArray as $innerRow => $value)
<td>{{$value}}</td>
@endforeach
@endforeach
result:
looping month only