Overview
The User model extends Laravel’s Authenticatable class and implements email verification. It represents users who can manage their accounts, categories, transactions, and track their net worth.Properties
Unique identifier for the user
The user’s display name
The user’s email address (must be unique)
Timestamp when the email was verified
Hashed password (nullable for social authentication users)
Token for “remember me” functionality (hidden from serialization)
OAuth provider name (e.g., ‘google’, ‘github’) for social authentication
Unique identifier from the OAuth provider
When the user was created
When the user was last updated
Fillable Attributes
The following attributes can be mass-assigned:nameemailpasswordproviderprovider_id
Hidden Attributes
These attributes are hidden from serialization for security:passwordremember_token
Relationships
accounts()
Returns all accounts belonging to the user. Type: HasMany Returns:Illuminate\Database\Eloquent\Relations\HasMany
categories()
Returns all categories created by the user. Type: HasMany Returns:Illuminate\Database\Eloquent\Relations\HasMany
transactions()
Returns all transactions belonging to the user. Type: HasMany Returns:Illuminate\Database\Eloquent\Relations\HasMany
netWorth()
Returns all net worth records for the user. Type: HasMany Returns:Illuminate\Database\Eloquent\Relations\HasMany
Methods
isSocialiteUser()
Determines if the user authenticated via a social provider (OAuth). Returns:boolean
Description: Returns true if the user has no password set, indicating they use social authentication.
Traits
HasFactory- Enables model factories for testingNotifiable- Adds notification capabilities
Interfaces
MustVerifyEmail- Requires email verification for authentication