mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Add missing method.
This commit is contained in:
parent
65c49c7a71
commit
be844b82af
@ -764,4 +764,30 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
|
|
||||||
return $journal->transactionGroup;
|
return $journal->transactionGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function findByAccountNumber(string $number, array $types): ?Account
|
||||||
|
{
|
||||||
|
$dbQuery = $this->user
|
||||||
|
->accounts()
|
||||||
|
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
|
||||||
|
->where('accounts.active', true)
|
||||||
|
->where(
|
||||||
|
function (EloquentBuilder $q1) use ($number) {
|
||||||
|
$json = json_encode($number);
|
||||||
|
$q1->where('account_meta.name', '=', 'account_number');
|
||||||
|
$q1->where('account_meta.data', '=', $json);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (0 !== count($types)) {
|
||||||
|
$dbQuery->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
|
||||||
|
$dbQuery->whereIn('account_types.type', $types);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $dbQuery->first(['accounts.*']);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user