- Bill 모델: V8 확장 필드 54개 추가 (증권종류, 할인, 배서, 추심, 개서, 부도 등) - Bill 상태: 수취/발행 어음·수표별 세분화된 상태 체계 - BillService: assignV8Fields/syncInstallments 헬퍼 추출, instrument_type/medium 필터 - BillInstallment: type/counterparty 필드 추가 - Loan 모델: holding/used/disposed 상태 + metadata(JSON) 필드 추가 - LoanService: 상품권 카테고리 지원 (summary 상태별 집계, store 기본상태 holding) - FormRequest: V8 확장 필드 검증 규칙 추가 - 마이그레이션: bills V8 필드 + loans metadata 컬럼 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
59 lines
1.2 KiB
PHP
59 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Tenants;
|
|
|
|
use App\Traits\Auditable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class BillInstallment extends Model
|
|
{
|
|
use Auditable;
|
|
|
|
protected $fillable = [
|
|
'bill_id',
|
|
'type',
|
|
'installment_date',
|
|
'amount',
|
|
'counterparty',
|
|
'note',
|
|
'created_by',
|
|
];
|
|
|
|
protected $casts = [
|
|
'installment_date' => 'date',
|
|
'amount' => 'decimal:2',
|
|
'bill_id' => 'integer',
|
|
];
|
|
|
|
/**
|
|
* 배열/JSON 변환 시 날짜 형식 지정
|
|
*/
|
|
public function toArray(): array
|
|
{
|
|
$array = parent::toArray();
|
|
|
|
if (isset($array['installment_date']) && $this->installment_date) {
|
|
$array['installment_date'] = $this->installment_date->format('Y-m-d');
|
|
}
|
|
|
|
return $array;
|
|
}
|
|
|
|
/**
|
|
* 어음 관계
|
|
*/
|
|
public function bill(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Bill::class);
|
|
}
|
|
|
|
/**
|
|
* 생성자 관계
|
|
*/
|
|
public function creator(): BelongsTo
|
|
{
|
|
return $this->belongsTo(\App\Models\Members\User::class, 'created_by');
|
|
}
|
|
}
|