@if($class) @foreach ($class as $c) {{$c->class_name}} @php $total_student = DB::connection('mysql_second')->table('running_student_info')->where('class_id',$c->id) ->count(); @endphp {{$total_student}} @php $total_present = DB::connection('mysql_second')->table('attendance')->where('class_id',$c->id)->where('attendance',1) ->where('attend_date',$from_date) ->count(); @endphp {{$total_present}} {{$total_student - $total_present}} @endforeach @endif