Performance workarounds as a result of 1bba21 - need to work on with()

This commit is contained in:
Deon George
2021-07-02 15:10:22 +10:00
parent 1bba21dcef
commit 90190bb301
5 changed files with 13 additions and 10 deletions

View File

@@ -5,7 +5,7 @@
</div>
<div class="card-body">
@if($o->invoices->where('due','>',0)->count())
@if(($x=$o->invoices()->with(['items.taxes','paymentitems.payment','account'])->get()->where('due','>',0))->count())
<table class="table table-bordered w-100" id="invoices_due">
<thead>
<tr>
@@ -20,7 +20,7 @@
</thead>
<tbody>
@foreach ($o->invoices->where('due','>',0) as $oo)
@foreach ($x as $oo)
<tr @if ($oo->due_date->isPast()) class="table-danger" @endif>
<td>{{ $oo->account->name }}</td>
<td><a href="{{ url('u/invoice',$oo->id) }}">{{ $oo->sid }}</a></td>