IsPrincipal
trait IsPrincipal
Default implementation of the IsPrincipal contract, reading values off public model properties by their configured column names. A model satisfies the contract by using this trait and declaring properties matching the configured column names; the identifier, password, and remember-me token are then resolved dynamically from those properties.
To point a model at differently-named columns, OVERRIDE THE GETTER METHOD (not the property — see note below), e.g. getRememberTokenName().
NOTE: The name properties below cannot be safely overridden by redeclaration in a using class — PHP requires a redeclared trait property to keep an identical default, so a differing value is a fatal error. Override the corresponding getter instead. Returning null from getRememberTokenName() disables remember-me for the model (the token methods become no-ops), which is how a model whose remember-me state lives outside the table opts out.
Properties
| protected string | $authIdentifierName | The name of the column holding the principal's unique identifier. |
|
| protected string | $authPasswordName | The name of the column holding the principal's hashed password. |
|
| protected string|null | $rememberTokenName | The name of the column holding the remember-me token, or null to disable remember-me for the model. Override getRememberTokenName() to change this per model. |
Methods
Gets the value of the primary identifier.
Gets the name of the primary identifier column.
Gets the hashed password for this user.
Gets the name of the password column.
Gets the current remember-me token.
Gets the remember-me column name or null to disable the feature for this model.
Sets token value to persist.
Details
at line 54
mixed
getAuthIdentifier()
Gets the value of the primary identifier.
at line 63
string
getAuthIdentifierName()
Gets the name of the primary identifier column.
at line 72
string|null
getAuthPassword()
Gets the hashed password for this user.
at line 81
string
getAuthPasswordName()
Gets the name of the password column.
at line 90
string|null
getRememberToken()
Gets the current remember-me token.
at line 102
string|null
getRememberTokenName()
Gets the remember-me column name or null to disable the feature for this model.
at line 112
void
setRememberToken(string $value)
Sets token value to persist.