mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fix various piggy bank errors
This commit is contained in:
@@ -349,7 +349,15 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
||||
|
||||
public function searchPiggyBank(string $query, int $limit): Collection
|
||||
{
|
||||
$search = $this->user->piggyBanks();
|
||||
$search = PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id')
|
||||
->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id')
|
||||
->where('accounts.user_id', auth()->user()->id)
|
||||
->with(
|
||||
[
|
||||
'objectGroups',
|
||||
]
|
||||
)
|
||||
->orderBy('piggy_banks.order', 'ASC')->distinct();
|
||||
if ('' !== $query) {
|
||||
$search->whereLike('piggy_banks.name', sprintf('%%%s%%', $query));
|
||||
}
|
||||
@@ -357,7 +365,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
||||
->orderBy('piggy_banks.name', 'ASC')
|
||||
;
|
||||
|
||||
return $search->take($limit)->get();
|
||||
return $search->take($limit)->get(['piggy_banks.*']);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
|
Reference in New Issue
Block a user