mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-18 18:44:16 +00:00
Fix nullpointer.
This commit is contained in:
@@ -305,9 +305,15 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte
|
|||||||
|
|
||||||
public function getPiggyBanks(): Collection
|
public function getPiggyBanks(): Collection
|
||||||
{
|
{
|
||||||
return PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id')
|
$query = PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id')
|
||||||
->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id')
|
->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id');
|
||||||
->where('accounts.user_id', $this->user->id)
|
if (null === $this->user) {
|
||||||
|
$query->where('accounts.user_group_id', $this->userGroup->id);
|
||||||
|
}
|
||||||
|
if (null !== $this->user) {
|
||||||
|
$query->where('accounts.user_id', $this->user->id);
|
||||||
|
}
|
||||||
|
return $query
|
||||||
->with(
|
->with(
|
||||||
[
|
[
|
||||||
'objectGroups',
|
'objectGroups',
|
||||||
|
Reference in New Issue
Block a user