移除字段

2018-02-24 15:52 更新

要移除字段,可在結(jié)構(gòu)生成器內(nèi)使用 dropColumn 方法,請(qǐng)確認(rèn)在移除前 composer.json 文件內(nèi)已經(jīng)加入 doctrine/dbal。

移除數(shù)據(jù)表字段

Schema::table('users', function($table)
{
    $table->dropColumn('votes');
});

移除數(shù)據(jù)表多個(gè)字段

Schema::table('users', function($table)
{
    $table->dropColumn(['votes', 'avatar', 'location']);
});
以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)