/** * Saves settings * @return array|bool */ public function save() { /** * @var string $key * @var Setting $setting */ foreach ($this->_settingModels as $key => $setting) { if (!$setting->validate()) { $this->addErrors([$key => $setting->errors]); } } if (!$this->hasErrors()) { foreach ($this->_settingModels as $key => $setting) { Setting::set("{$setting->section}.{$key}", $setting->value); } return true; } else { return false; } }