Student
class Student extends BaseModel (View source)
Represents a student with encrypted personal information (CPF, email, phone).
Provides relationships to loans and school classes.
Properties
| bool | $incrementing | Indicates that the model does not use auto-incrementing IDs. |
from BaseModel |
| protected string | $keyType | The data type of the primary key ID. |
from BaseModel |
| bool | $timestamps | Indicates if the model should not use timestamps. |
|
| protected string | $table | The database table associated with the model. |
|
| protected array<int,string> | $fillable | The attributes that are mass assignable. |
|
| $hidden | The attributes that should be hidden for serialization. |
Methods
Converts the binary UUID stored in the database into a string UUID.
Sets and encrypts the CPF, also stores its SHA-256 hash.
Sets and encrypts the email, also stores its SHA-256 hash.
Sets and encrypts the phone number, also stores its SHA-256 hash.
Gets the decrypted CPF.
Gets the decrypted email.
Gets the decrypted phone number, formatted if possible.
Relationship: Student has many loans.
Relationship: Student belongs to many school classes.
Details
string|null
getIdAttribute(mixed $value)
Converts the binary UUID stored in the database into a string UUID.
static protected void
boot()
Boot function for the model.
This ensures that every new record automatically gets a UUID assigned if no ID is provided during creation.
void
setCpfAttribute(string $value)
Sets and encrypts the CPF, also stores its SHA-256 hash.
void
setEmailAttribute(string $value)
Sets and encrypts the email, also stores its SHA-256 hash.
void
setPhoneAttribute(string $value)
Sets and encrypts the phone number, also stores its SHA-256 hash.
string|null
getCpfAttribute(null|string $value)
Gets the decrypted CPF.
string|null
getEmailAttribute(null|string $value)
Gets the decrypted email.
string|null
getPhoneAttribute(null|string $value)
Gets the decrypted phone number, formatted if possible.
HasMany
loans()
Relationship: Student has many loans.
BelongsToMany
schoolClasses()
Relationship: Student belongs to many school classes.