public function update() { $settings = Option::lists('option_value', 'option_key'); foreach (Input::all() as $key => $value) { if (starts_with($key, '_') === false) { $key = str_replace('-', '.', $key); $value = trim($value); if (!is_null(MainHelper::stringToBool($value))) { $value = MainHelper::stringToBool($value); } else { if (empty($value)) { $value = null; } } if ($value != $settings[$key]) { Option::where('option_key', $key)->update(['option_value' => $value]); } } } return Redirect::route('admin.site.settings.index')->with('messages', ['Settings Saved!']); }