【发布时间】:2015-09-12 01:12:27
【问题描述】:
在启动时我的 ConfigServerProvider.php 中有对 configs 数据库表的引用。在初始迁移时,此数据库表不存在,因此出现错误。如何在第一次运行 'php artisan migrate' 的同时保持此引导行完好无损?
public function boot() {
config([
'version' => "1.0.2",
'title' => Config::where('name', 'title')->first()->pluck('value')
]);
}
我在整个配置中添加了这个:
if(Schema::hasTable('configs')) { }
这似乎使一切正常。
【问题讨论】:
-
你需要编写一些代码来检查表是否存在......