more eager loading

This commit is contained in:
Denis Duliçi
2020-06-06 22:57:29 +03:00
parent 657c86a29c
commit a16406ea1e
10 changed files with 11 additions and 11 deletions

View File

@@ -22,7 +22,7 @@ class TotalExpenses extends Widget
$current += $transaction->getAmountConvertedToDefault();
});
$this->applyFilters(Bill::accrued()->notPaid(), ['date_field' => 'created_at'])->each(function ($bill) use (&$open, &$overdue) {
$this->applyFilters(Bill::with('transactions')->accrued()->notPaid(), ['date_field' => 'created_at'])->each(function ($bill) use (&$open, &$overdue) {
list($open_tmp, $overdue_tmp) = $this->calculateDocumentTotals($bill);
$open += $open_tmp;