feat: 가지급금 관리 API 구현

- loans 테이블 마이그레이션 추가
- Loan 모델 (인정이자 계산, 세금 계산 로직)
- LoanService (CRUD, 정산, 인정이자 계산/리포트)
- LoanController, FormRequest 5개
- 9개 API 라우트 등록
- i18n 키 추가 (validation)
This commit is contained in:
2025-12-18 14:27:10 +09:00
parent 8b30a555d2
commit af833194ea
11 changed files with 1065 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('loans', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('tenant_id')->comment('테넌트 ID');
$table->unsignedBigInteger('user_id')->comment('가지급금 수령자');
$table->date('loan_date')->comment('지급일');
$table->decimal('amount', 15, 2)->comment('가지급금액');
$table->text('purpose')->nullable()->comment('사용목적');
$table->date('settlement_date')->nullable()->comment('정산일');
$table->decimal('settlement_amount', 15, 2)->nullable()->comment('정산금액');
$table->string('status', 20)->default('outstanding')->comment('상태: outstanding/settled/partial');
$table->unsignedBigInteger('withdrawal_id')->nullable()->comment('출금 연결');
$table->unsignedBigInteger('created_by')->nullable()->comment('생성자');
$table->unsignedBigInteger('updated_by')->nullable()->comment('수정자');
$table->unsignedBigInteger('deleted_by')->nullable()->comment('삭제자');
$table->softDeletes();
$table->timestamps();
$table->index(['tenant_id', 'user_id'], 'idx_tenant_user');
$table->index('status', 'idx_status');
$table->index(['tenant_id', 'loan_date'], 'idx_tenant_date');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('loans');
}
};