diff --git a/app/Http/Controllers/Banking/Accounts.php b/app/Http/Controllers/Banking/Accounts.php index bf9eda309..21a5f3a7e 100644 --- a/app/Http/Controllers/Banking/Accounts.php +++ b/app/Http/Controllers/Banking/Accounts.php @@ -19,7 +19,7 @@ class Accounts extends Controller */ public function index() { - $accounts = Account::collect(); + $accounts = Account::with('income_transactions', 'expense_transactions')->collect(); return $this->response('banking.accounts.index', compact('accounts')); } diff --git a/app/Http/Controllers/Banking/Reconciliations.php b/app/Http/Controllers/Banking/Reconciliations.php index f5782e783..f10b07add 100644 --- a/app/Http/Controllers/Banking/Reconciliations.php +++ b/app/Http/Controllers/Banking/Reconciliations.php @@ -180,7 +180,7 @@ class Reconciliations extends Controller $started = explode(' ', $started_at)[0] . ' 00:00:00'; $ended = explode(' ', $ended_at)[0] . ' 23:59:59'; - $transactions = Transaction::where('account_id', $account->id)->whereBetween('paid_at', [$started, $ended])->get(); + $transactions = Transaction::with('account', 'contact')->where('account_id', $account->id)->whereBetween('paid_at', [$started, $ended])->get(); return collect($transactions)->sortByDesc('paid_at'); } diff --git a/app/Http/Controllers/Purchases/Vendors.php b/app/Http/Controllers/Purchases/Vendors.php index 9e73c41c3..131a2c56f 100644 --- a/app/Http/Controllers/Purchases/Vendors.php +++ b/app/Http/Controllers/Purchases/Vendors.php @@ -78,7 +78,7 @@ class Vendors extends Controller } // Handle payments - $transactions = Transaction::with('category')->where('contact_id', $vendor->id)->expense()->get(); + $transactions = Transaction::with('account', 'category')->where('contact_id', $vendor->id)->expense()->get(); $counts['transactions'] = $transactions->count(); diff --git a/app/Http/Controllers/Sales/Customers.php b/app/Http/Controllers/Sales/Customers.php index 70ee6f8ef..b5e430b77 100644 --- a/app/Http/Controllers/Sales/Customers.php +++ b/app/Http/Controllers/Sales/Customers.php @@ -76,7 +76,7 @@ class Customers extends Controller } // Handle transactions - $transactions = Transaction::with('category')->where('contact_id', $customer->id)->income()->get(); + $transactions = Transaction::with('account', 'category')->where('contact_id', $customer->id)->income()->get(); $counts['transactions'] = $transactions->count();