diff --git a/app/Helpers/Options.php b/app/Helpers/Options.php index 761d946..dae270e 100644 --- a/app/Helpers/Options.php +++ b/app/Helpers/Options.php @@ -5,6 +5,7 @@ namespace App\Helpers; use App\Options as Option; use Illuminate\Support\Facades\Cache; +use Illuminate\Support\Facades\Log; class Options { @@ -15,6 +16,7 @@ class Options if (is_null($value)) { + Log::info('Option ' . $option . 'not found in cache, refreshing from database'); $value = Option::where('option_name', $option)->first(); if (is_null($value)) throw new \Exception('This option does not exist.'); @@ -59,10 +61,19 @@ class Options $dbOptionInstance = Option::find($dbOption->first()->id); Cache::forget($option); + Log::warning('Changing db configuration option', [ + 'old_value' => $dbOptionInstance->option_value, + 'new_value' => $newValue + ]); $dbOptionInstance->option_value = $newValue; $dbOptionInstance->save(); + Log::warning('New db configuration option saved', + [ + 'option' => $dbOptionInstance->option_value + ]); + Cache::put('option_name', $newValue, now()->addDay()); } else diff --git a/app/Http/Controllers/OptionsController.php b/app/Http/Controllers/OptionsController.php index 436dbab..0e6a914 100644 --- a/app/Http/Controllers/OptionsController.php +++ b/app/Http/Controllers/OptionsController.php @@ -40,9 +40,8 @@ class OptionsController extends Controller } catch(\Exception $ex) { - // Silently ignore, because the only way this would happen is if someone manipulates the page, - // and obviously we can't save arbitrary option values even if the user has permission to do so. - continue; + $request->session()->flash('error', 'An error occurred while trying to save settings: ' . $ex->getMessage()); + exit; } }