当我将多个发票分配给同一用户时,会发生这种情况。 它必须给我另一行:
希瑟姆-> 55
希瑟姆-> 500
查看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>
发票金额视图:
@foreach($userinvoice as $amount)
<div class="col-md-2"> {{$amount->amount}}</div>
@endforeach
谢谢!
答案 0 :(得分:1)
您可以尝试这样做:
<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>