BankAccountType::class, 'enabled' => 'boolean', ]; protected $appends = [ 'mask', ]; public function account(): BelongsTo { return $this->belongsTo(Account::class, 'account_id'); } public function connectedBankAccount(): HasOne { return $this->hasOne(ConnectedBankAccount::class, 'bank_account_id'); } public function institution(): BelongsTo { return $this->belongsTo(Institution::class, 'institution_id'); } public function transactions(): HasMany { return $this->hasMany(Transaction::class, 'bank_account_id'); } protected function mask(): Attribute { return Attribute::get(static function (mixed $value, array $attributes): ?string { return $attributes['number'] ? '•••• ' . substr($attributes['number'], -4) : null; }); } protected static function newFactory(): Factory { return BankAccountFactory::new(); } }