diff --git a/app/Models/Tenants/Leave.php b/app/Models/Tenants/Leave.php index dc5a9af..eee6d93 100644 --- a/app/Models/Tenants/Leave.php +++ b/app/Models/Tenants/Leave.php @@ -53,6 +53,7 @@ class Leave extends Model 'status', 'approved_by', 'approved_at', + 'approval_id', 'reject_reason', 'created_by', 'updated_by', diff --git a/database/migrations/2026_02_28_200000_add_approval_id_to_leaves_table.php b/database/migrations/2026_02_28_200000_add_approval_id_to_leaves_table.php new file mode 100644 index 0000000..fe80767 --- /dev/null +++ b/database/migrations/2026_02_28_200000_add_approval_id_to_leaves_table.php @@ -0,0 +1,24 @@ +unsignedBigInteger('approval_id')->nullable()->after('status')->comment('연결된 결재 문서 ID'); + $table->index('approval_id'); + }); + } + + public function down(): void + { + Schema::table('leaves', function (Blueprint $table) { + $table->dropIndex(['approval_id']); + $table->dropColumn('approval_id'); + }); + } +}; diff --git a/database/migrations/2026_02_28_200100_insert_leave_approval_form.php b/database/migrations/2026_02_28_200100_insert_leave_approval_form.php new file mode 100644 index 0000000..9829591 --- /dev/null +++ b/database/migrations/2026_02_28_200100_insert_leave_approval_form.php @@ -0,0 +1,40 @@ +insertOrIgnore([ + 'tenant_id' => 1, + 'name' => '휴가신청', + 'code' => 'leave', + 'category' => 'request', + 'template' => json_encode([ + 'fields' => [ + ['name' => 'user_name', 'type' => 'text', 'label' => '신청자'], + ['name' => 'leave_type', 'type' => 'text', 'label' => '휴가유형'], + ['name' => 'period', 'type' => 'text', 'label' => '기간'], + ['name' => 'days', 'type' => 'number', 'label' => '일수'], + ['name' => 'reason', 'type' => 'text', 'label' => '사유'], + ['name' => 'remaining_days', 'type' => 'text', 'label' => '잔여연차'], + ], + ], JSON_UNESCAPED_UNICODE), + 'is_active' => true, + 'created_by' => 1, + 'created_at' => now(), + 'updated_at' => now(), + ]); + } + + public function down(): void + { + DB::table('approval_forms') + ->where('tenant_id', 1) + ->where('code', 'leave') + ->delete(); + } +};