User
class User extends User implements JWTSubject (View source)
Class User.
Represents a system user with authentication via JWT. Handles encrypted email storage, password hashing, and relations with password reset codes.
Properties
| bool | $incrementing | Indicates if the IDs are auto-incrementing. |
|
| bool | $timestamps | Indicates if the model should not use timestamps. |
|
| protected string | $table | The database table associated with the model. |
|
| protected string | $keyType | The primary key type. |
|
| protected array<int,string> | $fillable | The attributes that are mass assignable. |
|
| $hidden | The attributes that should be hidden for arrays. |
Methods
Get the UUID string of the user's ID.
Encrypt and store the user's email, and store its hash for lookup.
Decrypt the stored email.
Hash and store the password securely.
Relationship: User has many password reset codes.
Get the identifier for JWT (primary key).
Return a key-value array of custom JWT claims.
Get the password for authentication.
Boot method to generate UUID before creating a new user.
Details
string|null
getIdAttribute(null|string $value)
Get the UUID string of the user's ID.
void
setEmailAttribute(string $value)
Encrypt and store the user's email, and store its hash for lookup.
string|null
getEmailAttribute(string|null $value)
Decrypt the stored email.
void
setPasswordAttribute(string $value)
Hash and store the password securely.
HasMany
passwordResetCodes()
Relationship: User has many password reset codes.
null|string
getJWTIdentifier()
Get the identifier for JWT (primary key).
array
getJWTCustomClaims()
Return a key-value array of custom JWT claims.
string
getAuthPassword()
Get the password for authentication.
static protected void
boot()
Boot method to generate UUID before creating a new user.