- $value = $this->getValueFromStore($key, $default);
- return $this->formatValue($value, $default);
+ if ($default === false) $default = config('setting-defaults.' . $key, false);
+ if (isset($this->localCache[$key])) return $this->localCache[$key];
+
+ $value = $this->getValueFromStore($key, $default);
+ $formatted = $this->formatValue($value, $default);
+ $this->localCache[$key] = $formatted;
+ return $formatted;
+ }
+
+ /**
+ * Get a user-specific setting from the database or cache.
+ * @param User $user
+ * @param $key
+ * @param bool $default
+ * @return bool|string
+ */
+ public function getUser($user, $key, $default = false)
+ {
+ return $this->get($this->userKey($user->id, $key), $default);