- Plan/Subscription/Payment 모델에 상태 상수, 스코프, 헬퍼 메서드 추가 - PlanService, SubscriptionService, PaymentService 생성 - PlanController, SubscriptionController, PaymentController 생성 - FormRequest 9개 생성 (Plan 3개, Subscription 3개, Payment 3개) - Swagger 문서 3개 생성 (PlanApi, SubscriptionApi, PaymentApi) - API 라우트 22개 등록 (Plan 7개, Subscription 8개, Payment 7개) - Pint 코드 스타일 정리
45 lines
1.7 KiB
PHP
45 lines
1.7 KiB
PHP
<?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');
|
|
}
|
|
};
|