Bladeren bron

表字段新增

durong 5 jaren geleden
bovenliggende
commit
df92737ac3

+ 1 - 1
app/Models/CmsSubject.php

@@ -15,7 +15,7 @@ class CmsSubject extends BaseModel
      * 可被批量赋值的字段
      * @var array
      */
-    protected $fillable = ['city_id','city_name','title','show_type','is_open','used_count'];
+    protected $fillable = ['city_id','city_name','title','show_type','is_open','used_count','used_mall','subject_img'];
 
     //一对多关联专题商品表
     public function cmsSubjectProduct()

+ 35 - 0
database/migrations/2019_07_08_085907_add_used_mall_to_cms_subject_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddUsedMallToCmsSubjectTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('cms_subject', function (Blueprint $table) {
+            $table->tinyInteger('used_mall')->default(1)->comment('对应商城:0.兑换商城;1.电商商城');
+            $table->string('subject_img')->default('')->comment('专题顶图');
+            \Illuminate\Support\Facades\DB::statement("ALTER TABLE cms_subject MODIFY COLUMN show_type TINYINT (4) NOT NULL DEFAULT 0 COMMENT '商品展示方式:0:左图右字;1:通栏大图;2:左右滑动;3.左右两列'");
+        });
+
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('cms_subject', function (Blueprint $table) {
+            //
+        });
+    }
+}