/** * Set a specific key to a value in the settings data. * * @param string|array $key Key string or associative array of key => value * @param mixed $value Optional only if the first argument is an array */ public function set($key, $value = null) { $this->checkLoaded(); $this->unsaved = true; if (is_array($key)) { foreach ($key as $k => $v) { Arr::set($this->data, $k, $v); } } else { Arr::set($this->data, $key, $value); } }
/** * {@inheritdoc} */ protected function read() { $results = []; foreach ($this->model()->get() as $setting) { /** @var Setting $setting */ Arr::set($results, $setting->key, $setting->value); } return $results; }