Skip to content

Commit

Permalink
v73.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gammamatrix committed Mar 8, 2024
1 parent 0cec24a commit fc26bf0
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/Issuer.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ class Issuer
'root',
];

public function useSanctum(): bool
{
return $this->useSanctum;
}

/**
* @return array<int, string>
*/
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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;
}
Expand All @@ -362,6 +376,9 @@ public function sanctum(Authenticatable $user): array
* @var array<string, mixed> $config
*/
$config = config('playground-auth.token');
// dump([
// '$config' => $config,
// ]);

$this->init($user);

Expand Down

0 comments on commit fc26bf0

Please sign in to comment.