Skip to main content

User Model

Definition and Role

The User model represents an authenticated user in the application. It handles authentication, authorization, notifications, wallets, activity logging, and settings management.

Relationships

The User model manages various relationships within the system:

  • Roles & Permissions: The user can have multiple roles and permissions using Spatie Permission.
    public function roles(): BelongsToMany
    {
    return $this->belongsToMany(Role::class);
    }

  • Wallet: The user has a virtual wallet that allows them to manage and store balance, handle transactions, and track financial activity using Bavix Wallet Wallet:
    public function getBalance(): float
    {
    return $this->balance;
    }

  • Settings: The user has individual settings stored in the database using HasSettingsTable
    public function settings()
    {
    return $this->settings;
    }

  • Activity Logs: The User model tracks user actions using Spatie Activity Log
    public function getActivitylogOptions(): LogOptions
    {
    return LogOptions::defaults();
    }


  • Panel Access: The User model determines if a user can access Filament admin panels
    public function canAccessPanel(Panel $panel): bool
    {
    return true;
    }

table columns

  • id
  • first_name
  • last_name
  • email
  • password
  • avatar_url
  • email_verified_at
  • remember_token
  • created_at
  • updated_at