From 6dab5bded8cd131bf6f5629b48d633df03e3212e Mon Sep 17 00:00:00 2001 From: Deon George Date: Wed, 2 Feb 2022 17:12:17 +1100 Subject: [PATCH] Query performance improvements for home --- app/Models/User.php | 4 +++- .../theme/backend/adminlte/r/invoice/widgets/due.blade.php | 1 + .../theme/backend/adminlte/u/service/widgets/active.blade.php | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Models/User.php b/app/Models/User.php index 22fcaaf..937c198 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -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'); } diff --git a/resources/views/theme/backend/adminlte/r/invoice/widgets/due.blade.php b/resources/views/theme/backend/adminlte/r/invoice/widgets/due.blade.php index 2069bcb..aa139f1 100644 --- a/resources/views/theme/backend/adminlte/r/invoice/widgets/due.blade.php +++ b/resources/views/theme/backend/adminlte/r/invoice/widgets/due.blade.php @@ -1,3 +1,4 @@ +
diff --git a/resources/views/theme/backend/adminlte/u/service/widgets/active.blade.php b/resources/views/theme/backend/adminlte/u/service/widgets/active.blade.php index 154affe..cc630c5 100644 --- a/resources/views/theme/backend/adminlte/u/service/widgets/active.blade.php +++ b/resources/views/theme/backend/adminlte/u/service/widgets/active.blade.php @@ -1,3 +1,4 @@ +