class DatabaseTokenRepository implements TokenRepositoryInterface (View source)

Properties

protected ConnectionInterface $connection

The database connection instance.

protected Hasher $hasher

The Hasher implementation.

protected string $table

The token database table.

protected string $hashKey

The hashing key.

protected int $expires

The number of seconds a token should last.

protected int $throttle

Minimum number of seconds before re-redefining the token.

Methods

void
__construct(ConnectionInterface $connection, Hasher $hasher, string $table, string $hashKey, int $expires = 60, int $throttle = 60)

Create a new token repository instance.

string
create(CanResetPassword $user)

Create a new token record.

int
deleteExisting(CanResetPassword $user)

Delete all existing reset tokens from the database.

array
getPayload(string $email, string $token)

Build the record payload for the table.

bool
exists(CanResetPassword $user, string $token)

Determine if a token record exists and is valid.

bool
tokenExpired(string $createdAt)

Determine if the token has expired.

bool
recentlyCreatedToken(CanResetPassword $user)

Determine if the given user recently created a password reset token.

bool
tokenRecentlyCreated(string $createdAt)

Determine if the token was recently created.

void
delete(CanResetPassword $user)

Delete a token record by user.

void
deleteExpired()

Delete expired tokens.

string
createNewToken()

Create a new token for the user.

getConnection()

Get the database connection instance.

getTable()

Begin a new database query against the table.

getHasher()

Get the hasher instance.

Details

void __construct(ConnectionInterface $connection, Hasher $hasher, string $table, string $hashKey, int $expires = 60, int $throttle = 60)

Create a new token repository instance.

Parameters

ConnectionInterface $connection
Hasher $hasher
string $table
string $hashKey
int $expires
int $throttle

Return Value

void

string create(CanResetPassword $user)

Create a new token record.

Parameters

CanResetPassword $user

Return Value

string

protected int deleteExisting(CanResetPassword $user)

Delete all existing reset tokens from the database.

Parameters

CanResetPassword $user

Return Value

int

protected array getPayload(string $email, string $token)

Build the record payload for the table.

Parameters

string $email
string $token

Return Value

array

bool exists(CanResetPassword $user, string $token)

Determine if a token record exists and is valid.

Parameters

CanResetPassword $user
string $token

Return Value

bool

protected bool tokenExpired(string $createdAt)

Determine if the token has expired.

Parameters

string $createdAt

Return Value

bool

bool recentlyCreatedToken(CanResetPassword $user)

Determine if the given user recently created a password reset token.

Parameters

CanResetPassword $user

Return Value

bool

protected bool tokenRecentlyCreated(string $createdAt)

Determine if the token was recently created.

Parameters

string $createdAt

Return Value

bool

void delete(CanResetPassword $user)

Delete a token record by user.

Parameters

CanResetPassword $user

Return Value

void

void deleteExpired()

Delete expired tokens.

Return Value

void

string createNewToken()

Create a new token for the user.

Return Value

string

ConnectionInterface getConnection()

Get the database connection instance.

Return Value

ConnectionInterface

protected Builder getTable()

Begin a new database query against the table.

Return Value

Builder

Hasher getHasher()

Get the hasher instance.

Return Value

Hasher

Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.