*/ use HasFactory, Notifiable, HasApiTokens; /** * The attributes that are mass assignable. * * @var list */ protected $fillable = [ 'name', 'first_name', 'last_name', 'email', 'phone_country_code', 'phone', 'accept_whatsapp', 'accept_emails', 'avatar', 'country', 'timezone', 'locale', 'password', 'is_admin', ]; /** * The attributes that should be hidden for serialization. * * @var list */ protected $hidden = [ 'password', 'remember_token', ]; /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'password' => 'hashed', 'is_admin' => 'boolean', 'accept_whatsapp' => 'boolean', 'accept_emails' => 'boolean', ]; } /** * Get full name attribute */ public function getFullNameAttribute(): string { if ($this->first_name && $this->last_name) { return "{$this->first_name} {$this->last_name}"; } return $this->name ?? ''; } /** * Get full phone with country code */ public function getFullPhoneAttribute(): ?string { if ($this->phone_country_code && $this->phone) { return "{$this->phone_country_code} {$this->phone}"; } return $this->phone; } /** * Verifica se o usuário é administrador */ public function isAdmin(): bool { return $this->is_admin === true; } }