From 0d2eef58944dc75416e46bf9bf3111de0f26a6e4 Mon Sep 17 00:00:00 2001 From: Wes Hulette Date: Fri, 2 Nov 2018 15:23:41 -0400 Subject: [PATCH] v5 Develop Fixed: Setup error because setting table does not exist (#6390) * Fixed missing oauth tables during setup. * Merge remote-tracking branch 'snipe-it-upstream/develop' into develop * Merge remote-tracking branch 'snipe-it-upstream/develop' into develop Merge remote-tracking branch 'origin/develop' into develop * Fixed error during setup when settings table is not present --- app/Models/Setting.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Models/Setting.php b/app/Models/Setting.php index 89ca0feff5..77d72d4138 100755 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -103,12 +103,17 @@ class Setting extends Model * * @since 5.0.0 * - * @return \App\Models\Setting + * @return \App\Models\Setting|null */ - public static function getSettings() + public static function getSettings(): ?Setting { return Cache::rememberForever(self::APP_SETTINGS_KEY, function () { - return self::first(); + // Need for setup as no tables exist + try { + return self::first(); + } catch (\Throwable $th) { + return null; + } }); }