From fe00c4c3738cbcda564834da666d63e50bab9beb Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 29 Dec 2024 06:08:35 +0100 Subject: [PATCH] Fix unauthenticated get default currency. --- app/Support/Amount.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Support/Amount.php b/app/Support/Amount.php index aea73d2114..13f399e5cc 100644 --- a/app/Support/Amount.php +++ b/app/Support/Amount.php @@ -160,10 +160,12 @@ class Amount public function getDefaultCurrency(): TransactionCurrency { - /** @var User $user */ - $user = auth()->user(); - - return $this->getDefaultCurrencyByUserGroup($user->userGroup); + if(auth()->check()) { + /** @var User $user */ + $user = auth()->user(); + return $this->getDefaultCurrencyByUserGroup($user->userGroup); + } + return $this->getSystemCurrency(); } public function getDefaultCurrencyByUserGroup(UserGroup $userGroup): TransactionCurrency