I have a problem where I don't know how to show the subject where the sum '>0', I managed to show all of the subjects, but it shows with the subject that has sum '0' too. I'm not sure where to put the condition code, is it in view or controller.
this is my controller
public function showSubjectListFinalYear(){
$t1 = DB::table('matrices')->where('total_subject_left','<',10)->sum('teknologi_dan_sistem_maklumat');
$t2 = DB::table('matrices')->where('total_subject_left','<',10)->sum('struktur_diskrit');
$t3 = DB::table('matrices')->where('total_subject_left','<',10)->sum('teknik_pengaturcaraan_1');
$t4 = DB::table('matrices')->where('total_subject_left','<',10)->sum('logik_digital');
return view('admin.final_year_subject_list')>with(compact('t1','t2','t3','t4'));
this is the code in my view
<thead>
<tr>
<th>Subject name</th>
<th>No. of students</th>
</tr>
</thead>
<tbody>
<tr class="gradeX">
<td>Teknologi dan Sistem Maklumat</td>
<td style="text-align:center"></td>
</tr>
<tr class="gradeX">
<td>Struktur diskrit</td>
<td style="text-align:center"></td>
</tr>
<tr class="gradeX">
<td>Teknik Pengaturcaraan 1</td>
<td style="text-align:center"></td>
</tr>
<tr class="gradeX">
<td>Logik Digital</td>
<td style="text-align:center"></td>
</tr>
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire