- leaves, leave_balances 테이블 마이그레이션 추가 - Leave, LeaveBalance 모델 구현 (BelongsToTenant, SoftDeletes) - LeaveService 서비스 구현 (CRUD, 승인/반려/취소, 잔여일수 관리) - LeaveController 및 FormRequest 5개 생성 - API 엔드포인트 11개 등록 (/v1/leaves/*) - Swagger 문서 (LeaveApi.php) 작성 - i18n 메시지 키 추가 (message.leave.*, error.leave.*)
41 lines
1.8 KiB
PHP
41 lines
1.8 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
Schema::create('leaves', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->unsignedBigInteger('tenant_id')->comment('테넌트 ID');
|
|
$table->unsignedBigInteger('user_id')->comment('신청자 ID');
|
|
$table->string('leave_type', 20)->comment('휴가유형: annual/half_am/half_pm/sick/family/maternity/parental');
|
|
$table->date('start_date')->comment('시작일');
|
|
$table->date('end_date')->comment('종료일');
|
|
$table->decimal('days', 3, 1)->comment('사용일수');
|
|
$table->text('reason')->nullable()->comment('휴가 사유');
|
|
$table->string('status', 20)->default('pending')->comment('상태: pending/approved/rejected/cancelled');
|
|
$table->unsignedBigInteger('approved_by')->nullable()->comment('승인자 ID');
|
|
$table->timestamp('approved_at')->nullable()->comment('승인/반려 일시');
|
|
$table->text('reject_reason')->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(['start_date', 'end_date'], 'idx_dates');
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('leaves');
|
|
}
|
|
};
|