From 827bab48dad462446857bd364a77fd49887ca94f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Sat, 8 Apr 2023 11:06:52 -0700 Subject: [PATCH] fixed n+1 queries --- app/Http/Controllers/Purchases/Vendors.php | 2 +- app/Http/Controllers/Sales/Customers.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Purchases/Vendors.php b/app/Http/Controllers/Purchases/Vendors.php index c220329f2..2b15a6753 100644 --- a/app/Http/Controllers/Purchases/Vendors.php +++ b/app/Http/Controllers/Purchases/Vendors.php @@ -30,7 +30,7 @@ class Vendors extends Controller */ public function index() { - $vendors = Contact::with('bills.transactions')->vendor()->collect(); + $vendors = Contact::with('bills.histories', 'bills.totals', 'bills.transactions', 'media')->vendor()->collect(); return $this->response('purchases.vendors.index', compact('vendors')); } diff --git a/app/Http/Controllers/Sales/Customers.php b/app/Http/Controllers/Sales/Customers.php index 9dc36a2cd..3a7381d34 100644 --- a/app/Http/Controllers/Sales/Customers.php +++ b/app/Http/Controllers/Sales/Customers.php @@ -30,7 +30,7 @@ class Customers extends Controller */ public function index() { - $customers = Contact::customer()->with('invoices.transactions')->collect(); + $customers = Contact::customer()->with('invoices.histories', 'invoices.totals', 'invoices.transactions', 'media')->collect(); return $this->response('sales.customers.index', compact('customers')); }