From b9b829db7f73aa5b6076500473128cc80d2ce899 Mon Sep 17 00:00:00 2001 From: FreeScout Date: Mon, 10 Dec 2018 00:58:39 -0800 Subject: [PATCH] Fix getOptions() default value --- app/Option.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Option.php b/app/Option.php index 361cd525..853e891d 100644 --- a/app/Option.php +++ b/app/Option.php @@ -150,8 +150,10 @@ class Option extends Model foreach ($options as $name) { if (isset(self::$cache[$name])) { if (self::$cache[$name] == self::CACHE_DEFAULT_VALUE) { - if (empty($defaults[$name])) { + if (!isset($defaults[$name])) { $default = self::getDefault($name); + } else { + $default = $defaults[$name]; } $values[$name] = $default; } else { @@ -168,8 +170,10 @@ class Option extends Model $db_options = self::whereIn('name', $options)->get(); foreach ($options as $name) { // If not passed, get default value from config - if (empty($defaults[$name])) { + if (!isset($defaults[$name])) { $default = self::getDefault($name); + } else { + $default = $defaults[$name]; } $db_option = $db_options->where('name', $name)->first(); if ($db_option) {