From baddf3fc7671dbd3b2704b7e057a8a032c27c522 Mon Sep 17 00:00:00 2001 From: Miguel N Date: Wed, 6 Jan 2021 01:02:47 +0000 Subject: [PATCH] Save value instead of raw model to cache --- app/Helpers/Options.php | 3 ++- resources/views/dashboard/administration/settings.blade.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Helpers/Options.php b/app/Helpers/Options.php index 527eac9..9fffca9 100755 --- a/app/Helpers/Options.php +++ b/app/Helpers/Options.php @@ -30,6 +30,7 @@ class Options public function getOption(string $option): string { $value = Cache::get($option); + if (is_null($value)) { Log::debug('Option '.$option.'not found in cache, refreshing from database'); @@ -37,7 +38,7 @@ class Options if (is_null($value)) { throw new \Exception('This option does not exist.'); } - Cache::put($option, $value); + Cache::put($option, $value->option_value); Cache::put($option.'_desc', 'Undefined description'); return $value->option_value; diff --git a/resources/views/dashboard/administration/settings.blade.php b/resources/views/dashboard/administration/settings.blade.php index 5c5f39b..514e403 100755 --- a/resources/views/dashboard/administration/settings.blade.php +++ b/resources/views/dashboard/administration/settings.blade.php @@ -47,7 +47,7 @@