Don't use same name in a loop, change it like this: @foreach($check as $ck) {{ $ck }}
</tr>
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Controller: public function index() { $check = \DB::table('balance_fees')->select(DB::raw('sum(balance_fees) as total_fees')) ->groupBy ('student_id') ->get(); $semester = Semesters::lists('semester','id')->all(); $branch = Semesters::lists('branch')->all(); $students = Students::all(); // return $check; return view('students.index', compact('semester','branch','students','check')); }
view: @extends('layouts.header')
@section('content')
ID Full Name Mobile Number Semester Branch Total Fees Fees Paid Balance Fees </tr>
</thead>
<tbody> @foreach($check as $check)
<tr>
<td>{{ $check }}</td>
</tr> @endforeach </tbody>
Please or to participate in this conversation.