Various code cleanup and sorting.

This commit is contained in:
James Cole
2025-03-08 19:55:21 +01:00
parent 2d3d3bc0a4
commit 30b7e17b6f
60 changed files with 1402 additions and 1475 deletions

View File

@@ -67,8 +67,7 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac
->transactionJournals()
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
->whereIn('transaction_types.type', $types)
->get(['transaction_journals.*'])
;
->get(['transaction_journals.*']);
}
/**
@@ -102,7 +101,7 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac
*/
public function getJournalTotal(TransactionJournal $journal): string
{
$cache = new CacheProperties();
$cache = new CacheProperties();
$cache->addProperty($journal->id);
$cache->addProperty('amount-positive');
if ($cache->has()) {
@@ -151,8 +150,7 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac
return new Carbon($cache->get());
}
$entry = TransactionJournalMeta::where('transaction_journal_id', $journalId)
->where('name', $field)->first()
;
->where('name', $field)->first();
if (null === $entry) {
return null;
}
@@ -195,8 +193,7 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac
public function searchJournalDescriptions(string $search, int $limit): Collection
{
$query = $this->user->transactionJournals()
->orderBy('date', 'DESC')
;
->orderBy('date', 'DESC');
if ('' !== $search) {
$query->whereLike('description', sprintf('%%%s%%', $search));
}