@foreach($data as $key=>$value) @php $value=$value->toArray(); $emp_id = $value['emp_id']; unset($value['attendance_record']); unset($value['emp_id']); unset($value['fdate']); $total_leaves = 0; @endphp @if($data_type=='balance') @foreach($value as $index) {{$index}} @endforeach() @else @foreach($value as $info=>$index) @if($info == 'name') {{$index}} @else @if($info != 'empcode') @php $total_leaves += $index; @endphp @endif {{$index}} @endif @endforeach() {{$total_leaves}} @php $total_leaves = 0; @endphp @endif @endforeach()