Поддержка тегов шаблонами
This commit is contained in:
@@ -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'] ?? [],
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,11 +13,13 @@ class DocumentTemplate extends Model
|
||||
'description',
|
||||
'content',
|
||||
'variables',
|
||||
'source_path'
|
||||
'source_path',
|
||||
'tags'
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'variables' => 'array'
|
||||
'variables' => 'array',
|
||||
'tags' => 'array',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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::table('document_templates', function (Blueprint $table) {
|
||||
$table->json('tags')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('document_templates', function (Blueprint $table) {
|
||||
$table->dropColumn('tags');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user