From fc26bf0c6ed899a4dd2ac00af2bc5c0aab7edd35 Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Fri, 8 Mar 2024 11:22:21 -0800 Subject: [PATCH] v73.0.0 --- src/Issuer.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Issuer.php b/src/Issuer.php index 0d62b4f..875d3dd 100644 --- a/src/Issuer.php +++ b/src/Issuer.php @@ -64,6 +64,11 @@ class Issuer 'root', ]; + public function useSanctum(): bool + { + return $this->useSanctum; + } + /** * @return array */ @@ -250,10 +255,14 @@ public function init(Authenticatable $user): self $config = is_array($config) ? $config : []; if ($user instanceof HasApiTokens || is_callable([$user, 'createToken'])) { - $this->hasSanctum = ! empty($config['sanctum']); + $this->hasSanctum = true; } else { $this->hasSanctum = false; } + + if ($this->hasSanctum && ! empty($config['sanctum'])) { + $this->useSanctum = true; + } // dd([ // '__METHOD__' => __METHOD__, // '$user' => $user->toArray(), @@ -349,6 +358,11 @@ public function authorize(Authenticatable $user): array } else { $tokens = []; } + // dd([ + // '$tokens' => $tokens, + // '$this->useSanctum' => $this->useSanctum, + // '$this->hasSanctum' => $this->hasSanctum, + // ]); return $tokens; } @@ -362,6 +376,9 @@ public function sanctum(Authenticatable $user): array * @var array $config */ $config = config('playground-auth.token'); + // dump([ + // '$config' => $config, + // ]); $this->init($user);