Browse Source

自定义字段添加备注字段

kely 11 months ago
parent
commit
480a2dd18b

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

@@ -22,6 +22,7 @@ class CustomFieldResource extends JsonResource
             'options' => $this->options,
             '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'
+        'group', 'key', 'options', 'type', 'required', 'label','remark'
     ];
 
     protected $casts = [

+ 30 - 0
database/migrations/2024_03_27_151013_add_remark_to_custom_fields.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->string('remark')->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        Schema::table('custom_fields', function (Blueprint $table) {
+            //
+            $table->dropColumn('remark');
+        });
+    }
+};