diff --git a/app/Services/OptionForm.php b/app/Services/OptionForm.php index 2e78c2b1..893b7823 100644 --- a/app/Services/OptionForm.php +++ b/app/Services/OptionForm.php @@ -250,7 +250,8 @@ class OptionForm continue; } - if (($data = Arr::get($_POST, $item->id)) != option($item->id)) { + // compare with raw option value + if (($data = Arr::get($_POST, $item->id)) != option($item->id, null, true)) { Option::set($item->id, $data); } } diff --git a/app/Services/Repositories/OptionRepository.php b/app/Services/Repositories/OptionRepository.php index 8b4336b9..116cacbb 100644 --- a/app/Services/Repositories/OptionRepository.php +++ b/app/Services/Repositories/OptionRepository.php @@ -32,10 +32,10 @@ class OptionRepository extends Repository * * @param string $key * @param mixed $default - * @param bool $bool convert '0', '1' to bool value + * @param raw $raw return raw value without convertion * @return mixed */ - public function get($key, $default = null) + public function get($key, $default = null, $raw = false) { if (!$this->has($key) && Arr::has(config('options'), $key)) { $this->set($key, config("options.$key")); @@ -43,6 +43,8 @@ class OptionRepository extends Repository $value = Arr::get($this->items, $key, $default); + if ($raw) return $value; + switch (strtolower($value)) { case 'true': case '(true)':