Reputation: 79
this happens when I attribute multiple invoices to the same user. It must give me another row:
Hicham -> 55
Hicham ->500
View 1 :
<tbody>
@foreach($userinvoice as $uinvoice)
@if(count($uinvoice->userinvoice))
<tr>
<td scope="row">{{$uinvoice->user_name}}</td>
<td>@include('invoiceamount',['userinvoice'=>$uinvoice->userinvoice])</td>
</tr>
@endif
@endforeach
</tbody>
Invoiceamount View :
@foreach($userinvoice as $amount)
<div class="col-md-2"> {{$amount->amount}}</div>
@endforeach
Thank you !
Upvotes: 0
Views: 24
Reputation: 801
You could try and do like that:
<tbody>
@foreach($userinvoice as $uinvoice)
@if(count($uinvoice->userinvoice))
@foreach($uinvoice->userinvoice as $amount)
<tr>
<td scope="row">{{$uinvoice->user_name}}</td>
<td>{{$amount->amount}}</td>
</tr>
@endforeach
@endif
@endforeach
</tbody>
Upvotes: 1