samedi 2 mars 2019

Error in AppServiceProvider on table data reading on app installing

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(['mail.from.name' => 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(but it works ok onmy local )... Are there some other checks for this case.? If to comment all block with hasTable( above I have no this error...

Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire