Skip to content

Commit

Permalink
improved mergeConfigFromSettings() method to make sure db can conne…
Browse files Browse the repository at this point in the history
…ct and settings table exists
  • Loading branch information
roncodes committed Jun 9, 2023
1 parent 20890b9 commit bf2f0e1
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Providers/CoreServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Resources\Json\JsonResource;

/**
Expand Down Expand Up @@ -103,8 +104,18 @@ public function boot()
*/
public function mergeConfigFromSettings()
{
// Check if the settings table exists
if (!Schema::hasTable('settings')) {
try {
// Try to make a simple DB call
DB::connection()->getPdo();

// Check if the settings table exists
if (!Schema::hasTable('settings')) {
return;
}

// Rest of your function code...
} catch (\Exception $e) {
// Connection failed, or other error occurred
return;
}

Expand Down

0 comments on commit bf2f0e1

Please sign in to comment.