From e40555ad37dd3f95f974330d0bb9745a4e816201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Sat, 28 Feb 2026 15:54:34 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20[leaves]=20=ED=9C=B4=EA=B0=80-=EA=B2=B0?= =?UTF-8?q?=EC=9E=AC=20=EC=97=B0=EB=8F=99=EC=9D=84=20=EC=9C=84=ED=95=9C=20?= =?UTF-8?q?DB=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - leaves 테이블에 approval_id 컬럼 추가 (마이그레이션) - 휴가신청 결재 양식(approval_forms) 등록 (마이그레이션) - Leave 모델 fillable에 approval_id 추가 --- app/Models/Tenants/Leave.php | 1 + ...200000_add_approval_id_to_leaves_table.php | 24 +++++++++++ ...2_28_200100_insert_leave_approval_form.php | 40 +++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 database/migrations/2026_02_28_200000_add_approval_id_to_leaves_table.php create mode 100644 database/migrations/2026_02_28_200100_insert_leave_approval_form.php 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(); + } +};