class DatabaseTokenRepository implements TokenRepositoryInterface

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.

Methods

void
__construct(ConnectionInterface $connection, Hasher $hasher, string $table, string $hashKey, int $expires = 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.

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

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

Create a new token repository instance.

Parameters

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

Return Value

void

at line 74
string create(CanResetPassword $user)

Create a new token record.

Parameters

CanResetPassword $user

Return Value

string

at line 96
protected int deleteExisting(CanResetPassword $user)

Delete all existing reset tokens from the database.

Parameters

CanResetPassword $user

Return Value

int

at line 108
protected array getPayload(string $email, string $token)

Build the record payload for the table.

Parameters

string $email
string $token

Return Value

array

at line 120
bool exists(CanResetPassword $user, string $token)

Determine if a token record exists and is valid.

Parameters

CanResetPassword $user
string $token

Return Value

bool

at line 137
protected bool tokenExpired(string $createdAt)

Determine if the token has expired.

Parameters

string $createdAt

Return Value

bool

at line 148
void delete(CanResetPassword $user)

Delete a token record by user.

Parameters

CanResetPassword $user

Return Value

void

at line 158
void deleteExpired()

Delete expired tokens.

Return Value

void

at line 170
string createNewToken()

Create a new token for the user.

Return Value

string

at line 180
ConnectionInterface getConnection()

Get the database connection instance.

Return Value

ConnectionInterface

at line 190
protected Builder getTable()

Begin a new database query against the table.

Return Value

Builder

at line 200
Hasher getHasher()

Get the hasher instance.

Return Value

Hasher