Query performance improvements for home
This commit is contained in:
@@ -146,6 +146,7 @@ class User extends Authenticatable
|
||||
public function services()
|
||||
{
|
||||
return $this->hasManyThrough(Service::class,Account::class)
|
||||
->with(['product.type'])
|
||||
->active();
|
||||
}
|
||||
|
||||
@@ -592,7 +593,7 @@ class User extends Authenticatable
|
||||
->from($invoices->unionAll($payments),'invoices')
|
||||
->groupBy(['invoice_id']);
|
||||
|
||||
return (new Invoice)
|
||||
return (new Invoice)
|
||||
->select([
|
||||
'account_id',
|
||||
'id',
|
||||
@@ -607,6 +608,7 @@ class User extends Authenticatable
|
||||
DB::raw('ROUND(invoice_total-payments,2) AS balance'),
|
||||
])
|
||||
->join('ab_invoice',['ab_invoice.id'=>'invoice_id'])
|
||||
->with(['items.taxes'])
|
||||
->from($summary,'summary');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user