Performance workarounds as a result of 1bba21 - need to work on with()
This commit is contained in:
@@ -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>
|
||||
|
@@ -5,7 +5,7 @@
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
@if($o->invoices->where('date_orig','>',($x=\Carbon\Carbon::now()->subMonths(12)))->where('due','=',0)->count())
|
||||
@if(($x=$o->invoices()->where('ab_invoice.date_orig','>',\Carbon\Carbon::now()->subMonths(12)->unix())->with(['items.taxes','paymentitems.payment','account.country.currency'])->get()->where('due','<=',0))->count())
|
||||
<table class="table table-bordered w-100" id="invoices_past">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -19,7 +19,7 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($o->invoices->where('date_orig','>',$x)->where('due','=',0) as $oo)
|
||||
@foreach ($x as $oo)
|
||||
<tr>
|
||||
<td>{{ $oo->account->name }}</td>
|
||||
<td><a href="{{ url('u/invoice',$oo->id) }}">{{ $oo->sid }}</a></td>
|
||||
|
@@ -5,7 +5,7 @@
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
@if($o->payments->where('date_orig','>',($x=\Carbon\Carbon::now()->subMonths(12)))->count())
|
||||
@if(($x=$o->payments()->where('ab_payment.date_orig','>',\Carbon\Carbon::now()->subMonths(12)->unix())->with(['items','account'])->get())->count())
|
||||
<table class="table table-bordered w-100" id="payments_past">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -19,7 +19,7 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($o->payments->where('date_orig','>',($x=\Carbon\Carbon::now()->subMonths(12))) as $oo)
|
||||
@foreach ($x as $oo)
|
||||
<tr>
|
||||
<td>{{ $oo->account->name }}</td>
|
||||
<td>{{ $oo->sid }}</td>
|
||||
|
Reference in New Issue
Block a user