fix: [card] 카드 상세 수정/저장 누락 필드 9개 보강

- 마이그레이션: card_type, alias, cvc_encrypted, payment_day, total_limit, used_amount, remaining_limit, is_manual, memo 컬럼 추가
- Card 모델: $fillable, $casts, $hidden 확장 + CVC 암호화/복호화 메서드 추가
- CardService: store(), update() 메서드에 9개 필드 처리 로직 추가
- StoreCardRequest, UpdateCardRequest: 9개 필드 검증 규칙 추가
This commit is contained in:
김보곤
2026-02-21 00:11:03 +09:00
parent 961ab47bac
commit 83ddfabd7c
5 changed files with 154 additions and 0 deletions

View File

@@ -15,12 +15,21 @@ public function rules(): array
{
return [
'card_company' => ['required', 'string', 'max:50'],
'card_type' => ['nullable', 'string', 'max:50'],
'card_number' => ['required', 'string', 'regex:/^\d{13,19}$/'],
'expiry_date' => ['required', 'string', 'regex:/^(0[1-9]|1[0-2])\/\d{2}$/'],
'card_password' => ['nullable', 'string', 'size:2', 'regex:/^\d{2}$/'],
'card_name' => ['required', 'string', 'max:100'],
'alias' => ['nullable', 'string', 'max:100'],
'csv' => ['nullable', 'string', 'max:4'],
'payment_day' => ['nullable', 'integer', 'min:1', 'max:31'],
'total_limit' => ['nullable', 'numeric', 'min:0'],
'used_amount' => ['nullable', 'numeric', 'min:0'],
'remaining_limit' => ['nullable', 'numeric', 'min:0'],
'status' => ['nullable', 'string', 'in:active,inactive'],
'is_manual' => ['nullable', 'boolean'],
'assigned_user_id' => ['nullable', 'integer', 'exists:users,id'],
'memo' => ['nullable', 'string', 'max:500'],
];
}

View File

@@ -15,12 +15,21 @@ public function rules(): array
{
return [
'card_company' => ['sometimes', 'string', 'max:50'],
'card_type' => ['nullable', 'string', 'max:50'],
'card_number' => ['sometimes', 'string', 'regex:/^\d{13,19}$/'],
'expiry_date' => ['sometimes', 'string', 'regex:/^(0[1-9]|1[0-2])\/\d{2}$/'],
'card_password' => ['nullable', 'string', 'size:2', 'regex:/^\d{2}$/'],
'card_name' => ['sometimes', 'string', 'max:100'],
'alias' => ['nullable', 'string', 'max:100'],
'csv' => ['nullable', 'string', 'max:4'],
'payment_day' => ['nullable', 'integer', 'min:1', 'max:31'],
'total_limit' => ['nullable', 'numeric', 'min:0'],
'used_amount' => ['nullable', 'numeric', 'min:0'],
'remaining_limit' => ['nullable', 'numeric', 'min:0'],
'status' => ['sometimes', 'string', 'in:active,inactive'],
'is_manual' => ['nullable', 'boolean'],
'assigned_user_id' => ['nullable', 'integer', 'exists:users,id'],
'memo' => ['nullable', 'string', 'max:500'],
];
}