*/ use HasFactory, HasRoles, Notifiable, PasskeyAuthenticatable, TwoFactorAuthenticatable; protected $fillable = [ 'company_id', 'name', 'email', 'password', 'is_platform_admin', 'is_company_admin', 'status', ]; protected $hidden = ['password', 'two_factor_secret', 'two_factor_recovery_codes', 'remember_token']; protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'password' => 'hashed', 'is_platform_admin' => 'boolean', 'is_company_admin' => 'boolean', ]; } public function company(): BelongsTo { return $this->belongsTo(Company::class); } public function initials(): string { return Str::of($this->name) ->explode(' ') ->take(2) ->map(fn ($word) => Str::substr((string) $word, 0, 1)) ->implode(''); } public function isMpbaPlatformAdmin(): bool { return $this->is_platform_admin && $this->company?->is_system_company === true; } }