applyFilters(Transaction::with('recurring')->income()->isNotTransfer(), ['date_field' => 'paid_at']); $expense_transactions = $this->applyFilters(Transaction::with('recurring')->expense()->isNotTransfer(), ['date_field' => 'paid_at']); switch ($this->getSetting('basis')) { case 'cash': // Revenues $revenues = $income_transactions->get(); $this->setTotals($revenues, 'paid_at', true); // Payments $payments = $expense_transactions->get(); $this->setTotals($payments, 'paid_at', true); break; default: // Invoices $invoices = $this->applyFilters(Invoice::with('recurring', 'transactions')->accrued(), ['date_field' => 'invoiced_at'])->get(); Recurring::reflect($invoices, 'invoiced_at'); $this->setTotals($invoices, 'invoiced_at', true); // Revenues $revenues = $income_transactions->isNotDocument()->get(); Recurring::reflect($revenues, 'paid_at'); $this->setTotals($revenues, 'paid_at', true); // Bills $bills = $this->applyFilters(Bill::with('recurring', 'transactions')->accrued(), ['date_field' => 'billed_at'])->get(); Recurring::reflect($bills, 'bill', 'billed_at'); $this->setTotals($bills, 'billed_at', true); // Payments $payments = $expense_transactions->isNotDocument()->get(); Recurring::reflect($payments, 'paid_at'); $this->setTotals($payments, 'paid_at', true); break; } } }