W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
要建立一個(gè)新的數(shù)據(jù)表,可使用 Schema::create
方法:
Schema::create('users', function($table)
{
$table->increments('id');
});
傳入 create 方法的第一個(gè)參數(shù)是數(shù)據(jù)表名稱,第二個(gè)參數(shù)是 Closure 并接收 Blueprint 對(duì)象被用來定義新的數(shù)據(jù)表。
要修改數(shù)據(jù)表名稱,可使用 rename
方法:
Schema::rename($from, $to);
要指定特定連接來操作,可使用 Schema::connection
方法:
Schema::connection('foo')->create('users', function($table)
{
$table->increments('id');
});
要移除數(shù)據(jù)表,可使用 Schema::drop
方法:
Schema::drop('users');
Schema::dropIfExists('users');
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: