DatabaseTokenRepository
in package
implements
TokenRepositoryInterface
Interfaces, Classes and Traits
Table of Contents
- $connection : ConnectionInterface
- The database connection instance.
- $expires : int
- The number of seconds a token should last.
- $hasher : Hasher
- The Hasher implementation.
- $hashKey : string
- The hashing key.
- $table : string
- The token database table.
- __construct() : void
- Create a new token repository instance.
- create() : string
- Create a new token record.
- createNewToken() : string
- Create a new token for the user.
- delete() : void
- Delete a token record by user.
- deleteExpired() : void
- Delete expired tokens.
- exists() : bool
- Determine if a token record exists and is valid.
- getConnection() : ConnectionInterface
- Get the database connection instance.
- getHasher() : Hasher
- Get the hasher instance.
- deleteExisting() : int
- Delete all existing reset tokens from the database.
- getPayload() : array<string|int, mixed>
- Build the record payload for the table.
- getTable() : Builder
- Begin a new database query against the table.
- tokenExpired() : bool
- Determine if the token has expired.
Properties
$connection
The database connection instance.
protected
ConnectionInterface
$connection
$expires
The number of seconds a token should last.
protected
int
$expires
$hasher
The Hasher implementation.
protected
Hasher
$hasher
$hashKey
The hashing key.
protected
string
$hashKey
$table
The token database table.
protected
string
$table
Methods
__construct()
Create a new token repository instance.
public
__construct(ConnectionInterface $connection, Hasher $hasher, string $table, string $hashKey[, int $expires = 60 ]) : void
Parameters
- $connection : ConnectionInterface
- $hasher : Hasher
- $table : string
- $hashKey : string
- $expires : int = 60
Return values
void —create()
Create a new token record.
public
create(CanResetPassword $user) : string
Parameters
- $user : CanResetPassword
Return values
string —createNewToken()
Create a new token for the user.
public
createNewToken() : string
Return values
string —delete()
Delete a token record by user.
public
delete(CanResetPassword $user) : void
Parameters
- $user : CanResetPassword
Return values
void —deleteExpired()
Delete expired tokens.
public
deleteExpired() : void
Return values
void —exists()
Determine if a token record exists and is valid.
public
exists(CanResetPassword $user, string $token) : bool
Parameters
- $user : CanResetPassword
- $token : string
Return values
bool —getConnection()
Get the database connection instance.
public
getConnection() : ConnectionInterface
Return values
ConnectionInterface —getHasher()
Get the hasher instance.
public
getHasher() : Hasher
Return values
Hasher —deleteExisting()
Delete all existing reset tokens from the database.
protected
deleteExisting(CanResetPassword $user) : int
Parameters
- $user : CanResetPassword
Return values
int —getPayload()
Build the record payload for the table.
protected
getPayload(string $email, string $token) : array<string|int, mixed>
Parameters
- $email : string
- $token : string
Return values
array<string|int, mixed> —getTable()
Begin a new database query against the table.
protected
getTable() : Builder
Return values
Builder —tokenExpired()
Determine if the token has expired.
protected
tokenExpired(string $createdAt) : bool
Parameters
- $createdAt : string