From eb3c3b94d667121b197b9992c6f35661f8ace332 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 5 Feb 2018 15:22:51 +0000 Subject: [PATCH] hopefully fix upgrade issues from v1.0 --- app/Providers/AppServiceProvider.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 674b8290..283e15ba 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -4,6 +4,7 @@ namespace App\Providers; use Illuminate\Support\ServiceProvider; use Artisan; +use Schema; use App\Setting; class AppServiceProvider extends ServiceProvider @@ -27,16 +28,18 @@ class AppServiceProvider extends ServiceProvider //Artisan::call('route:cache'); } if(is_file(database_path(env('DB_DATABASE')))) { - if($bg_image = Setting::fetch('background_image')) { - $alt_bg = ' style="background-image: url('.asset('storage/'.$bg_image).')"'; - } + if(Schema::hasTable('settings')) { + if($bg_image = Setting::fetch('background_image')) { + $alt_bg = ' style="background-image: url('.asset('storage/'.$bg_image).')"'; + } - // check version to see if an upgrade is needed - $db_version = Setting::fetch('version'); - $app_version = config('app.version'); - if(version_compare($app_version, $db_version) == 1) { // app is higher than db, so need to run migrations etc - Artisan::call('migrate', array('--path' => 'database/migrations', '--force' => true, '--seed' => true)); - } + // check version to see if an upgrade is needed + $db_version = Setting::fetch('version'); + $app_version = config('app.version'); + if(version_compare($app_version, $db_version) == 1) { // app is higher than db, so need to run migrations etc + Artisan::call('migrate', array('--path' => 'database/migrations', '--force' => true, '--seed' => true)); + } + } } view()->share('alt_bg', $alt_bg);