Have you tried to use a nested foreach?
Apr 16, 2017
9
Level 13
How to limit value within foreach loop?
I try to make marksheet of students so there are four marks with subject id 1 so when i try to make print in foreach each loop its printing four times like
@foreach($exammarks as $exammark)
<tr>
<td rowspan="">{{$exammark->subjects['name'] }}</td>
<td rowspan="">{{$exammark->examnames['name'] }}</td>
<td>25</td>
<td>33</td>
</tr>
@endforeach
my query
$exammarks = ExamMark::whereHas('courses',function($q) use($course, $cdate){
$q->where('id',$course)
->where('created_at',$cdate);
})->orderBy('subject_id')
->where('student_id',Auth::id())
->with('courses','sections','examnames','subjects')
->get();
here output https://www.dropbox.com/s/k4mb8u8h3kdxo5v/2.PNG?dl=0
now here subjects repeating two times but i want to limit only one
Please or to participate in this conversation.