Skip to content

Firefly III: a personal finances manager

Can also collect budgets for user groups #11982

James Cole5894695ad6ab
diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php
index a336928995..0c50162b78 100644
--- a/app/Repositories/Budget/BudgetRepository.php
+++ b/app/Repositories/Budget/BudgetRepository.php
@@ -368,12 +368,10 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
public function getBudgets(): Collection
{
- return $this->user
- ->budgets()
- ->orderBy('order', 'ASC')
- ->orderBy('name', 'ASC')
- ->get()
- ;
+ if(null === $this->user) {
+ return $this->userGroup->budgets()->orderBy('order', 'ASC')->orderBy('name', 'ASC')->get();
+ }
+ return $this->user->budgets()->orderBy('order', 'ASC')->orderBy('name', 'ASC')->get();
}
/**