檢查是否存在

2018-02-24 15:52 更新

檢查數(shù)據表是否存在

您可以輕松的檢查數(shù)據表或字段是否存在,使用 hasTable 和 hasColumn 方法:

if (Schema::hasTable('users'))
{
    //
}

檢查字段是否存在

if (Schema::hasColumn('users', 'email'))
{
    //
}
以上內容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號