Skip to content

Commit fe361b9

Browse files
authored
[4.x] Remove generic requirement that token is an instance of a Model (#549)
* Update HasApiTokens.php * Update Sanctum.php
1 parent e4d2d10 commit fe361b9

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/HasApiTokens.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@
66
use Illuminate\Support\Str;
77

88
/**
9-
* @template TTokenModel of \Illuminate\Database\Eloquent\Model&\Laravel\Sanctum\Contracts\HasAbilities = \Laravel\Sanctum\PersonalAccessToken
9+
* @template TToken of Laravel\Sanctum\Contracts\HasAbilities = \Laravel\Sanctum\PersonalAccessToken
1010
*/
1111
trait HasApiTokens
1212
{
1313
/**
1414
* The access token the user is using for the current request.
1515
*
16-
* @var TTokenModel
16+
* @var TToken
1717
*/
1818
protected $accessToken;
1919

2020
/**
2121
* Get the access tokens that belong to model.
2222
*
23-
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<TTokenModel, $this>
23+
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<TToken, $this>
2424
*/
2525
public function tokens()
2626
{
@@ -78,7 +78,7 @@ public function generateTokenString()
7878
/**
7979
* Get the access token currently associated with the user.
8080
*
81-
* @return TTokenModel
81+
* @return TToken
8282
*/
8383
public function currentAccessToken()
8484
{
@@ -88,7 +88,7 @@ public function currentAccessToken()
8888
/**
8989
* Set the current access token for the user.
9090
*
91-
* @param TTokenModel $accessToken
91+
* @param TToken $accessToken
9292
* @return $this
9393
*/
9494
public function withAccessToken($accessToken)

src/Sanctum.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
use Mockery;
66

77
/**
8-
* @template TTokenModel of \Illuminate\Database\Eloquent\Model&\Laravel\Sanctum\Contracts\HasAbilities = \Laravel\Sanctum\PersonalAccessToken
8+
* @template TToken of \Laravel\Sanctum\Contracts\HasAbilities = \Laravel\Sanctum\PersonalAccessToken
99
*/
1010
class Sanctum
1111
{
1212
/**
1313
* The personal access client model class name.
1414
*
15-
* @var class-string<TTokenModel>
15+
* @var class-string<TToken>
1616
*/
1717
public static $personalAccessTokenModel = 'Laravel\\Sanctum\\PersonalAccessToken';
1818

@@ -78,7 +78,7 @@ public static function actingAs($user, $abilities = [], $guard = 'sanctum')
7878
/**
7979
* Set the personal access token model name.
8080
*
81-
* @param class-string<TTokenModel> $model
81+
* @param class-string<TToken> $model
8282
* @return void
8383
*/
8484
public static function usePersonalAccessTokenModel($model)
@@ -111,7 +111,7 @@ public static function authenticateAccessTokensUsing(callable $callback)
111111
/**
112112
* Get the token model class name.
113113
*
114-
* @return class-string<TTokenModel>
114+
* @return class-string<TToken>
115115
*/
116116
public static function personalAccessTokenModel()
117117
{

0 commit comments

Comments
 (0)