0

this happens when I attribute multiple invoices to the same user. It must give me another row:

Hicham -> 55

Hicham ->500

enter image description here

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 !

1 Answer 1

1

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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.