@foreach ($totallist as $li) @php $months = $li->months; $total = 0; @endphp @for($i=1; $i<=12; $i++) @php $total = $total + $months[$i]; $reqId = $i.'-'.$year.'-'.$user_id; @endphp @endfor @php $total = 0; @endphp @endforeach
Consultant Jan Feb Mar Apr May Jun Jul Aug Sept Oct Nov Dec Total
{{ $li->name }} @if($months[$i] != 0) {{ $months[$i] }} @else 0 @endif {{ $total }}