/** * Unset a key in the settings data. * * @param string $key */ public function forget($key) { $this->unsaved = true; if ($this->has($key)) { Arr::forget($this->data, $key); } }
/** * Parse data coming from the database. * * @param array $data * * @return array */ public function parseReadData($data) { $results = []; foreach ($data as $row) { if (is_array($row)) { $key = $row['key']; $value = $row['value']; } elseif (is_object($row)) { $key = $row->key; $value = $row->value; } else { $msg = 'Expected array or object, got ' . gettype($row); throw new \UnexpectedValueException($msg); } Arr::set($results, $key, $value); } return $results; }