6 months ago

Error in AppServiceProvider on table data reading on app installing

Posted 6 months ago by PetroGromovo

Hello, In my laravel 5.7 app I keep some settings in my db table and in my app/Providers/AppServiceProvider.php I have next lines :

class AppServiceProvider extends ServiceProvider
    use funcsTrait;

     * Bootstrap any application services.
     * @return void
    public function boot()

        if ( \Schema::hasTable(with( new Settings)->getTable() ) ) {
            $settingsArray = Settings::getSettingsList(['site_name', 'site_heading', 'noreply_email'], true);
            $site_name     = ($settingsArray['site_name'] ? $settingsArray['site_name'] : '');
            config(['feed.feeds.main.title' => htmlspecialchars_decode($site_name . ' : ' . $site_heading)]);
            config(['' => htmlspecialchars_decode($site_name . ' support')]);

But installing my app on production server I got error:

 php artisan config:cache
In Connection.php line 664:                                                                                                                                                                           
  SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' (SQL: select * from information_schema.tables where table_schema = Votes and table_name = vt_settings)  

Looks like hasTable( checks is not enough at some cases... Are there some other checks for this case.? If to comment all block with hasTable( above I have no this error...


Please sign in or create an account to participate in this conversation.