diff --git a/app/Models/Tenants/Card.php b/app/Models/Tenants/Card.php index 757f04c..a8a4cc8 100644 --- a/app/Models/Tenants/Card.php +++ b/app/Models/Tenants/Card.php @@ -73,6 +73,10 @@ class Card extends Model 'cvc_encrypted', ]; + protected $appends = [ + 'csv', + ]; + protected $attributes = [ 'status' => 'active', 'is_manual' => false, @@ -178,6 +182,18 @@ public function getDecryptedCvc(): ?string : null; } + // ========================================================================= + // Accessor (JSON 직렬화용) + // ========================================================================= + + /** + * CSV(CVC) 복호화 값 — $appends로 JSON 응답에 포함 + */ + public function getCsvAttribute(): ?string + { + return $this->getDecryptedCvc(); + } + // ========================================================================= // 헬퍼 메서드 // =========================================================================