@@ -77,7 +77,6 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @return bool |
79 | 79 | * |
80 | - |
|
81 | 80 | */ |
82 | 81 | public function destroy(Account $account, ?Account $moveTo): bool |
83 | 82 | { |
@@ -101,7 +100,7 @@ discard block |
||
101 | 100 | /** @var Account $account */ |
102 | 101 | foreach ($accounts as $account) { |
103 | 102 | $byName = $this->user->accounts()->where('name', $account->name) |
104 | - ->where('id', '!=', $account->id)->first(); |
|
103 | + ->where('id', '!=', $account->id)->first(); |
|
105 | 104 | if (null !== $byName) { |
106 | 105 | $result->push($account); |
107 | 106 | $result->push($byName); |
@@ -109,7 +108,7 @@ discard block |
||
109 | 108 | } |
110 | 109 | if (null !== $account->iban) { |
111 | 110 | $byIban = $this->user->accounts()->where('iban', $account->iban) |
112 | - ->where('id', '!=', $account->id)->first(); |
|
111 | + ->where('id', '!=', $account->id)->first(); |
|
113 | 112 | if (null !== $byIban) { |
114 | 113 | $result->push($account); |
115 | 114 | $result->push($byIban); |
@@ -400,9 +399,9 @@ discard block |
||
400 | 399 | { |
401 | 400 | |
402 | 401 | $journal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') |
403 | - ->where('transactions.account_id', $account->id) |
|
404 | - ->transactionTypes([TransactionType::OPENING_BALANCE]) |
|
405 | - ->first(['transaction_journals.*']); |
|
402 | + ->where('transactions.account_id', $account->id) |
|
403 | + ->transactionTypes([TransactionType::OPENING_BALANCE]) |
|
404 | + ->first(['transaction_journals.*']); |
|
406 | 405 | if (null === $journal) { |
407 | 406 | return null; |
408 | 407 | } |
@@ -424,9 +423,9 @@ discard block |
||
424 | 423 | public function getOpeningBalanceDate(Account $account): ?string |
425 | 424 | { |
426 | 425 | $journal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') |
427 | - ->where('transactions.account_id', $account->id) |
|
428 | - ->transactionTypes([TransactionType::OPENING_BALANCE]) |
|
429 | - ->first(['transaction_journals.*']); |
|
426 | + ->where('transactions.account_id', $account->id) |
|
427 | + ->transactionTypes([TransactionType::OPENING_BALANCE]) |
|
428 | + ->first(['transaction_journals.*']); |
|
430 | 429 | if (null === $journal) { |
431 | 430 | return null; |
432 | 431 | } |
@@ -513,12 +512,12 @@ discard block |
||
513 | 512 | public function oldestJournal(Account $account): ?TransactionJournal |
514 | 513 | { |
515 | 514 | $first = $account->transactions() |
516 | - ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') |
|
517 | - ->orderBy('transaction_journals.date', 'ASC') |
|
518 | - ->orderBy('transaction_journals.order', 'DESC') |
|
519 | - ->where('transaction_journals.user_id', $this->user->id) |
|
520 | - ->orderBy('transaction_journals.id', 'ASC') |
|
521 | - ->first(['transaction_journals.id']); |
|
515 | + ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') |
|
516 | + ->orderBy('transaction_journals.date', 'ASC') |
|
517 | + ->orderBy('transaction_journals.order', 'DESC') |
|
518 | + ->where('transaction_journals.user_id', $this->user->id) |
|
519 | + ->orderBy('transaction_journals.id', 'ASC') |
|
520 | + ->first(['transaction_journals.id']); |
|
522 | 521 | if (null !== $first) { |
523 | 522 | return TransactionJournal::find((int)$first->id); |
524 | 523 | } |
@@ -553,9 +552,9 @@ discard block |
||
553 | 552 | public function searchAccount(string $query, array $types): Collection |
554 | 553 | { |
555 | 554 | $dbQuery = $this->user->accounts() |
556 | - ->where('active', 1) |
|
557 | - ->orderBy('accounts.name', 'ASC') |
|
558 | - ->with(['accountType']); |
|
555 | + ->where('active', 1) |
|
556 | + ->orderBy('accounts.name', 'ASC') |
|
557 | + ->with(['accountType']); |
|
559 | 558 | if ('' !== $query) { |
560 | 559 | $search = sprintf('%%%s%%', $query); |
561 | 560 | $dbQuery->where('name', 'LIKE', $search); |