Clear
@foreach($waterTypes as $type) @endforeach @foreach($waterConsumptions as $date => $rows) @php $total = 0; @endphp @foreach($waterTypes as $type) @php $record = $rows->firstWhere('water_type_id', $type->id); $amount = $record ? $record->amount_ml : 0; $total += $amount; @endphp @endforeach @endforeach
ID Date{{ $type->wt_value }}Total (ml)
{{ $loop->iteration }} {{ \Carbon\Carbon::parse($date)->format('d-M-Y') }}{{ $amount }} {{ $total }}