@@ -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 | // split query on spaces just in case: |
561 | 560 | $parts = explode(' ', $query); |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | { |
309 | 309 | /** @var Collection $result */ |
310 | 310 | $query = $this->user->accounts()->with( |
311 | - ['accountmeta' => function (HasMany $query) { |
|
311 | + ['accountmeta' => function(HasMany $query) { |
|
312 | 312 | $query->where('name', 'account_role'); |
313 | 313 | }] |
314 | 314 | ); |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | if ('' !== $query) { |
560 | 560 | // split query on spaces just in case: |
561 | 561 | $parts = explode(' ', $query); |
562 | - foreach($parts as $part) { |
|
562 | + foreach ($parts as $part) { |
|
563 | 563 | $search = sprintf('%%%s%%', $part); |
564 | 564 | $dbQuery->where('name', 'LIKE', $search); |
565 | 565 | } |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | { |
622 | 622 | /** @var Collection $result */ |
623 | 623 | $query = $this->user->accounts()->with( |
624 | - ['accountmeta' => function (HasMany $query) { |
|
624 | + ['accountmeta' => function(HasMany $query) { |
|
625 | 625 | $query->where('name', 'account_role'); |
626 | 626 | }] |
627 | 627 | ); |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | $repository = app(AccountRepositoryInterface::class); |
64 | 64 | |
65 | 65 | // filter the account types: |
66 | - $allowedAccountTypes = [AccountType::ASSET, AccountType::EXPENSE, AccountType::REVENUE, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE,]; |
|
67 | - $balanceTypes = [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE,]; |
|
66 | + $allowedAccountTypes = [AccountType::ASSET, AccountType::EXPENSE, AccountType::REVENUE, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE, ]; |
|
67 | + $balanceTypes = [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE, ]; |
|
68 | 68 | $filteredAccountTypes = []; |
69 | 69 | foreach ($accountTypes as $type) { |
70 | 70 | if (in_array($type, $allowedAccountTypes, true)) { |
@@ -295,9 +295,9 @@ discard block |
||
295 | 295 | /** @var AccountRepositoryInterface $accountRepos */ |
296 | 296 | $accountRepos = app(AccountRepositoryInterface::class); |
297 | 297 | |
298 | - $piggies = $repository->getPiggyBanks(); |
|
298 | + $piggies = $repository->getPiggyBanks(); |
|
299 | 299 | $defaultCurrency = \Amount::getDefaultCurrency(); |
300 | - $response = []; |
|
300 | + $response = []; |
|
301 | 301 | /** @var PiggyBank $piggy */ |
302 | 302 | foreach ($piggies as $piggy) { |
303 | 303 | $currency = $accountRepos->getAccountCurrency($piggy->account) ?? $defaultCurrency; |