Reputation: 145
I wanted to assign a property to the first element of each serie (Value1) and y tried to do with the new Laravel $loop variable but nesting doesn't work. I tried to use $loop->first, but only works one on the first Group.
I tried to do the next:
- Group 1 $loop->index = 0 (parent)
- Value 1 $loop->index = 0
- Value 2 $loop->index = 1
- Value 3 $loop->index = 2
- Group 2 $loop->index = 1 (parent)
- Value 1 $loop->index = 3
- Value 2 $loop->index = 4
Seems the $loop->index (child) doesn't start a new serie. What can I do?
Upvotes: 1
Views: 465
Reputation: 145
@foreach($groups as $group)
<h3>Group {{ $group->name }}</h3>
<table>
<tr>
<td>SubGroup Name</td>
</tr>
@foreach($projects as $project)
<tr>
@if($loop->first)
<td rowspan="{{ $loop->count }}"></td>
@endif
<td>Target Language</td>
</tr>
@endforeach
</table>
@endforeach
Upvotes: 1