Skip to content

User

User model

Phone attributes

  • The User model exposes a virtual phone attribute that reads/writes meta['alternative_phone'].
  • There is no physical users.phone column; phone-related data is stored inside the JSON meta column.

Usage

  • Reading: $user->phone returns the value of meta['alternative_phone'] or null if not set.
  • Writing: $user->phone = '0123456789' persists to meta['alternative_phone'].

UI integration

  • Filament admin forms bind to phone (e.g., TextInput::make('phone')). The model accessors transparently map this to meta['alternative_phone'].

Imports

  • CSV field alternative_phone is mapped to the phone attribute during import. The mutator ensures it is saved to meta['alternative_phone'].

Implementation notes

  • Implementation resides in app/Models/User.php via getPhoneAttribute and setPhoneAttribute.
  • Ensure meta remains cast to array on the model so JSON persistence functions correctly.