I currently develop a blade View that will loop an array from Controller.
I just create a table that have an aspects, detail aspects, current status, and remark. So, I want loop (with foreach) at my blade view, then at my array there will be a condition that aspects have same value in next row.
For table example:
Aspects | Detail Aspects | Current Status | Remark
Curriculum | 1 | Good | Good
Curriculum | 2 | Good | Good
Curriculum | 3 | Good | Good
Teaching | 4 | Good | Good
So for the table, I want to check if prev.Aspect == current.Aspect
, so I don't need to print it again, or maybe I can rowspan that .
I already using $index at my foreach, but I only can print it as number, not accessing my Obj[index]
value.
Here my blade code :
<table border='1'>
<tr align='center' class='header'><td>Aspects</td><td>Details</td><td>Current Status</td><td>Remark</td></tr>
@foreach($prAspect as $index => $data)
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
@endforeach
</table>
via Willy Sandi