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

@@ -17,6 +17,7 @@
<div class="info-box-content">
<span class="info-box-text">Active Services</span>
<!-- @todo This should count of inactive services too -->
<span class="info-box-number">{{ $o->services->count() }} <small>/{{ $o->services->count() }}</small></span>
</div>
</div>
@@ -28,7 +29,7 @@
<div class="info-box-content">
<span class="info-box-text">Account Balance</span>
<span class="info-box-number"><small>$</small> {{ number_format($o->invoices_due->sum('due'),2) }}</span>
<span class="info-box-number"><small>$</small> {{ number_format(($x=$o->invoices()->with(['items.taxes','paymentitems.payment','account'])->get()->where('due','>',0))->sum('due'),2) }}</span>
</div>
</div>
</div>
@@ -39,7 +40,7 @@
<div class="info-box-content">
<span class="info-box-text">Invoices Due</span>
<span class="info-box-number">{{ $o->invoices_due->count() }}</span>
<span class="info-box-number">{{ $x->count() }}</span>
</div>
</div>
</div>
</div>