Ver código fonte

在NameRule中增加一个存放文本值的字段

kely 10 meses atrás
pai
commit
04f266c221

+ 1 - 0
app/Http/Resources/API/CustomFieldResource.php

@@ -20,6 +20,7 @@ class CustomFieldResource extends JsonResource
             'group' => $this->group,
             'label' => $this->label,
             'options' => $this->options,
+            'inputs' => $this->inputs,
             'type' => $this->type,
             'required' => $this->required,
             'remark' => $this->remark,

+ 1 - 1
app/Models/CustomField.php

@@ -13,7 +13,7 @@ class CustomField extends Model
     public $timestamps = false;
 
     protected $fillable = [
-        'group', 'key', 'options', 'type', 'required', 'label','remark'
+        'group', 'key', 'options', 'type', 'required', 'label','remark','inputs'
     ];
 
     protected $casts = [

+ 30 - 0
database/migrations/2024_04_19_113505_add_inputs_to_customfuled_table.php

@@ -0,0 +1,30 @@
+<?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('custom_fields', function (Blueprint $table) {
+            //
+            $table->json('inputs')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        Schema::table('custom_fields', function (Blueprint $table) {
+            //
+            $table->dropColumn('inputs');
+        });
+    }
+};