Fix budget date.

This commit is contained in:
James Cole 2020-08-08 11:07:08 +02:00
parent 73c1452aa9
commit be0f2f0b9f
No known key found for this signature in database
GPG Key ID: B5669F9493CDE38D

View File

@ -160,19 +160,9 @@ class BudgetRepository implements BudgetRepositoryInterface
$oldest = null;
$journal = $budget->transactionJournals()->orderBy('date', 'ASC')->first();
if (null !== $journal) {
$oldest = $journal->date < $oldest ? $journal->date : $oldest;
return $journal->date;
}
$transaction = $budget
->transactions()
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.id')
->orderBy('transaction_journals.date', 'ASC')->first(['transactions.*', 'transaction_journals.date']);
if (null !== $transaction) {
$carbon = new Carbon($transaction->date);
$oldest = $carbon < $oldest ? $carbon : $oldest;
}
return $oldest;
return null;
}
/**