- Bill 확장 필드 (V8), Loan 상품권 카테고리/접대비 자동 연동 - GeneralJournalEntry CRUD, AccountSubject API - 접대비/복리후생비 날짜 필터, 매출채권 soft delete 제외 - 바로빌 연동 API 엔드포인트 추가 - 부가세 상세 조회 API 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');
|
|
}
|
|
}
|