HasApiTokens
trait HasApiTokens
Properties
| protected null|TToken | $accessToken | The access token the user is using for the current request. |
Methods
bool
tokenCan(UnitEnum|string $ability)
Determine if the current API token has a given ability.
bool
tokenCant(UnitEnum|string $ability)
Determine if the current API token does not have a given ability.
createToken(string $name, array $abilities = ['*'], DateTimeInterface|null $expiresAt = null)
Create a new personal access token for the user.
string
generateTokenString()
Generate the token string.
HasAbilities|null
currentAccessToken()
Get the access token currently associated with the user.
Details
at line 32
MorphMany
tokens()
Get the access tokens that belong to model.
at line 40
bool
tokenCan(UnitEnum|string $ability)
Determine if the current API token has a given ability.
at line 48
bool
tokenCant(UnitEnum|string $ability)
Determine if the current API token does not have a given ability.
at line 58
NewAccessToken
createToken(string $name, array $abilities = ['*'], DateTimeInterface|null $expiresAt = null)
Create a new personal access token for the user.
at line 78
string
generateTokenString()
Generate the token string.
at line 93
HasAbilities|null
currentAccessToken()
Get the access token currently associated with the user.
at line 104
HasApiTokens
withAccessToken(HasAbilities|null $accessToken)
Set the current access token for the user.