Ken преди 2 седмици
родител
ревизия
9535bf7c90
променени са 3 файла, в които са добавени 35 реда и са изтрити 1 реда
  1. 1 0
      app/Http/Controllers/admin/Config.php
  2. 1 1
      app/Models/Config.php
  3. 33 0
      database/migrations/2025_11_04_162524_update_config.php

+ 1 - 0
app/Http/Controllers/admin/Config.php

@@ -30,6 +30,7 @@ class Config extends Controller
                 'id' => ['nullable', 'string'],
             ]);
             $search = request()->all();
+            $search['group_id'] = 1;
             $result = ConfigService::paginate($search);
         } catch (ValidationException $e) {
             return $this->error(HttpStatus::VALIDATION_FAILED, $e->validator->errors()->first());

+ 1 - 1
app/Models/Config.php

@@ -12,7 +12,7 @@ class Config extends Model
 {
     protected $table = 'config';
     protected $hidden = ['created_at', 'updated_at'];
-    protected $fillable = ['field', 'val', 'remark'];
+    protected $fillable = ['field', 'val', 'remark','group_id'];
 
     protected function getCreatedAtAttribute($value)
     {

+ 33 - 0
database/migrations/2025_11_04_162524_update_config.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
+
+return new class extends Migration {
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('config', function (Blueprint $table) {
+            $table->tinyInteger('group_id')->default(1)->comment('配置分组');
+        });
+
+        DB::table('config')->where('field', 'channel_message')->update(['group_id' => 2]);
+
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        //
+    }
+};