From 1bdda1bffc499653022eaa131f32293a2b9b68f0 Mon Sep 17 00:00:00 2001 From: Amir Khan Date: Wed, 30 Nov 2022 15:50:41 +0100 Subject: [PATCH 1/3] add helper to get permission via auth()->user() helper --- src/Models/Auth0User.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Models/Auth0User.php b/src/Models/Auth0User.php index fccb117..feaf1a8 100644 --- a/src/Models/Auth0User.php +++ b/src/Models/Auth0User.php @@ -17,6 +17,16 @@ public function getAccountNo() return $this->company['navision_account_no'] ?? null; } + /** + * Return the Can book with booking numbers permission + * + * @return boolean|null + */ + public function canBookWithBookingNumber(): ?bool + { + return $this->company['can_book_with_booking_numbers'] ?? false; + } + /** * Set multiple properties * From 2b06e832e0d777da843de3b61ac547414a3a19c5 Mon Sep 17 00:00:00 2001 From: Amir Khan Date: Thu, 1 Dec 2022 13:40:22 +0100 Subject: [PATCH 2/3] Remove null from return type --- src/Models/Auth0User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Models/Auth0User.php b/src/Models/Auth0User.php index feaf1a8..04fa8ee 100644 --- a/src/Models/Auth0User.php +++ b/src/Models/Auth0User.php @@ -20,7 +20,7 @@ public function getAccountNo() /** * Return the Can book with booking numbers permission * - * @return boolean|null + * @return boolean */ public function canBookWithBookingNumber(): ?bool { From 72515a98d533a4b75d8bc11eb3e9be0e636d32e3 Mon Sep 17 00:00:00 2001 From: Amir Khan Date: Thu, 1 Dec 2022 13:42:38 +0100 Subject: [PATCH 3/3] Remove null type --- src/Models/Auth0User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Models/Auth0User.php b/src/Models/Auth0User.php index 04fa8ee..864bb36 100644 --- a/src/Models/Auth0User.php +++ b/src/Models/Auth0User.php @@ -22,7 +22,7 @@ public function getAccountNo() * * @return boolean */ - public function canBookWithBookingNumber(): ?bool + public function canBookWithBookingNumber(): bool { return $this->company['can_book_with_booking_numbers'] ?? false; }