From 66d21688364258efbf75b7b852cc871098f5b483 Mon Sep 17 00:00:00 2001 From: brusnitsyn Date: Wed, 5 Nov 2025 16:30:24 +0900 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=B4=D0=B5=D1=80=D0=B6?= =?UTF-8?q?=D0=BA=D0=B0=20=D1=82=D0=B5=D0=B3=D0=BE=D0=B2=20=D1=88=D0=B0?= =?UTF-8?q?=D0=B1=D0=BB=D0=BE=D0=BD=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/DocImportController.php | 5 ++++ app/Models/DocumentTemplate.php | 6 ++-- ...tags_field_in_document_templates_table.php | 28 +++++++++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 database/migrations/2025_11_05_071604_add_tags_field_in_document_templates_table.php diff --git a/app/Http/Controllers/DocImportController.php b/app/Http/Controllers/DocImportController.php index 1878626..7e9edf0 100644 --- a/app/Http/Controllers/DocImportController.php +++ b/app/Http/Controllers/DocImportController.php @@ -24,6 +24,7 @@ class DocImportController extends Controller 'description' => $template->description, 'file_url' => $urlFile, 'variables' => $template->variables, + 'tags' => $template->tags ]); } @@ -35,6 +36,7 @@ class DocImportController extends Controller 'name' => 'nullable|string|max:255', 'description' => 'nullable|string', 'variables' => 'nullable|array', + 'tags' => 'nullable|array', ]); $template = DocumentTemplate::findOrFail($data['id']); @@ -53,6 +55,7 @@ class DocImportController extends Controller 'name' => $data['name'], 'description' => $data['description'], 'variables' => $data['variables'], + 'tags' => $data['tags'] ?? [], ]); } @@ -63,6 +66,7 @@ class DocImportController extends Controller 'name' => 'nullable|string|max:255', 'description' => 'nullable|string', 'variables' => 'nullable|array', + 'tags' => 'nullable|array', ]); $file = $request->file('file'); @@ -77,6 +81,7 @@ class DocImportController extends Controller 'content' => 'content', 'variables' => $data['variables'] ?? [], 'source_path' => "storage/$laravelPath" . '/' . $templateFileName, + 'tags' => $data['tags'] ?? [], ]); } diff --git a/app/Models/DocumentTemplate.php b/app/Models/DocumentTemplate.php index fe4394d..a66ac43 100644 --- a/app/Models/DocumentTemplate.php +++ b/app/Models/DocumentTemplate.php @@ -13,11 +13,13 @@ class DocumentTemplate extends Model 'description', 'content', 'variables', - 'source_path' + 'source_path', + 'tags' ]; protected $casts = [ - 'variables' => 'array' + 'variables' => 'array', + 'tags' => 'array', ]; /** diff --git a/database/migrations/2025_11_05_071604_add_tags_field_in_document_templates_table.php b/database/migrations/2025_11_05_071604_add_tags_field_in_document_templates_table.php new file mode 100644 index 0000000..8373324 --- /dev/null +++ b/database/migrations/2025_11_05_071604_add_tags_field_in_document_templates_table.php @@ -0,0 +1,28 @@ +json('tags')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('document_templates', function (Blueprint $table) { + $table->dropColumn('tags'); + }); + } +};