laravel-admin-extensions / config

Config manager for laravel-admin
http://laravel-admin.org/
MIT License
96 stars 56 forks source link

php artisan migrate 出错 #15

Closed xiaojinisking closed 5 years ago

xiaojinisking commented 6 years ago

php artisan migrate 执行时,假如是全新的数据库,里面没有admin_config表那么,就会被 AppServiceProvider.php 的Config::load() 的报错(表admin_config不存在)卡住

bahadorfarahani commented 6 years ago

I solve this problem by add this code to AppServiceProvider.php

use Illuminate\Database\Schema\Blueprint;

public function boot()
    {
        if(Schema::hasTable('admin_config')){
            Config::load();
        }
    }
zeyingli commented 5 years ago

执行php artisan migrate --path=vendor/laravel-admin-ext/config/database/migrations可添加config表

wuzhihui819 commented 5 years ago

我也遇到这个问题了,建议文档改成 @bahadorfarahani 所提供的的代码内容

z-song commented 5 years ago

php artisan migrate的运行在添加Config::load()之前,为什么会被卡住

wuzhihui819 commented 5 years ago

@z-song 部署时: 首先执行composer install下载本地开发已加到composer.json的config插件; composer会触发php artisan package:discover,进而执行 php artisan migrate; 执行php artisan migrate之前,程序会先运行 AppServiceProvider的boot方法,进而执行Config::load()(已在本地加入并提交), 然后会报config表不存在的错误。

z-song commented 5 years ago

@wuzhihui819 明白了