string('wechat_id')->after('id')->nullable()->comment('微信id'); }); } if(!Schema::hasColumn('users','mobile')){ Schema::table('users', function (Blueprint $table) { $table->char('mobile',11)->after('email')->index()->comment('手机'); }); } if(!Schema::hasColumn('users','nickname')){ Schema::table('users', function (Blueprint $table) { $table->string('nickname')->after('name')->nullable()->comment('昵称'); }); } if(!Schema::hasColumn('users','avatar')){ Schema::table('users', function (Blueprint $table) { $table->string('avatar')->after('mobile')->nullable()->comment('头像'); }); } if(!Schema::hasColumn('users','school_id')){ Schema::table('users', function (Blueprint $table) { $table->string('school_id')->after('avatar')->nullable()->comment('头像'); }); } if(!Schema::hasColumn('sclass_id','sclass')){ Schema::table('users', function (Blueprint $table) { $table->integer('sclass_id')->after('school_id')->nullable()->comment('班级'); }); } if(!Schema::hasColumn('grade_id','grade')){ Schema::table('users', function (Blueprint $table) { $table->integer('grade_id')->after('class_id')->nullable()->comment('班级'); }); } } /** * Reverse the migrations. * * @return void */ public function down() { if(Schema::hasColumn('users','mobile')){ Schema::table('users', function (Blueprint $table) { $table->dropColumn('mobile'); }); } if(Schema::hasColumn('users','nickname')){ Schema::table('users', function (Blueprint $table) { $table->dropColumn('nickname'); }); } if(Schema::hasColumn('users','avatar')){ Schema::table('users', function (Blueprint $table) { $table->dropColumn('avatar'); }); } } }