<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; use ModStart\Core\Dao\ModelManageUtil; class CreateBanner extends Migration { public function up() { if (ModelManageUtil::hasTable('banner')) { goto xL0pz; UTpSX: if (!in_array('sort', $foNFK)) { Schema::table('banner', function (Blueprint $fnOXp) { $fnOXp->integer('sort')->nullable()->comment('顺序'); }); } goto IvgGx; xL0pz: $foNFK = ModelManageUtil::listTableColumns('banner'); goto UBGbu; UBGbu: if (!in_array('position', $foNFK)) { Schema::table('banner', function (Blueprint $fnOXp) { $fnOXp->string('position', 50)->nullable()->comment('位置'); }); } goto UTpSX; IvgGx: } else { Schema::create('banner', function (Blueprint $fnOXp) { $fnOXp->increments('id'); $fnOXp->timestamps(); $fnOXp->string('position', 50)->nullable()->comment('位置'); $fnOXp->integer('sort')->nullable()->comment('顺序'); $fnOXp->string('image', 100)->nullable()->comment('图片'); $fnOXp->string('link', 200)->nullable()->comment('链接'); }); } } public function down() { } }