feat: 어음 관리(Bill Management) API 추가

- BillController: 어음 CRUD + 상태변경 + 요약 API
- BillService: 비즈니스 로직 (멀티테넌트 지원)
- Bill, BillInstallment 모델: 날짜 포맷(Y-m-d) toArray 오버라이드
- FormRequest: Store/Update/UpdateStatus 유효성 검사
- Swagger 문서: BillApi.php
- 마이그레이션: bills, bill_installments 테이블
- DummyBillSeeder: 테스트 데이터 30건 + 차수 12건
- API Routes: /api/v1/bills 엔드포인트 7개
This commit is contained in:
2025-12-23 23:42:02 +09:00
parent d6d004f32b
commit 71123128ff
11 changed files with 1442 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
<?php
namespace App\Models\Tenants;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class BillInstallment extends Model
{
protected $fillable = [
'bill_id',
'installment_date',
'amount',
'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');
}
}