Php 未定义的表错误:扩展用户';s插件
我试图扩展用户的表以向其添加更多字段,我将此作为我的代码保存在更新文件夹中的php文件中Php 未定义的表错误:扩展用户';s插件,php,laravel,octobercms,octobercms-plugins,Php,Laravel,Octobercms,Octobercms Plugins,我试图扩展用户的表以向其添加更多字段,我将此作为我的代码保存在更新文件夹中的php文件中 <?php namespace Corymillz\Store\Updates; use Schema; use October\Rain\Database\Updates\Migration; class AddNewFeilds extends Migration { public function up() { Schema::table('users',
<?php namespace Corymillz\Store\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class AddNewFeilds extends Migration
{
public function up()
{
Schema::table('users', function($table)
{
$table->string('store_title')->nullable();
$table->text('store_description')->nullable();
$table->string('background_color')->nullable();
$table->string('font_color')->nullable();
$table->string('font_family')->nullable();
$table->dateTime('last_seen')->nullable();
});
}
public function down()
{
$table->dropDown([
'store_title',
'store_description',
'background_color',
'font_color',
'font_family',
'last_seen'
]);
}
}
我认为您的down()
方法缺少代码
应该是这样的
在您的代码中,它抱怨$table variable
,因为它没有定义,还需要使用dropColumn
如果有任何疑问,请评论
public function down()
{
Schema::table('users', function($table) {
$table->dropColumn([
'store_title',
'store_description',
'background_color',
'font_color',
'font_family',
'last_seen'
]);
});
}