]> BookStack Code Mirror - bookstack/blobdiff - app/Settings/SettingService.php
Add min length validation on name on register form & add sign up link
[bookstack] / app / Settings / SettingService.php
index 42a3810608750c9afbdf4e3352c29350d9511d4d..489963aad7cde7b361ffdecfcb4e7d7edb4e3301 100644 (file)
@@ -41,6 +41,7 @@ class SettingService
         if ($default === false) {
             $default = config('setting-defaults.' . $key, false);
         }
+
         if (isset($this->localCache[$key])) {
             return $this->localCache[$key];
         }
@@ -66,6 +67,17 @@ class SettingService
         return $this->get($this->userKey($user->id, $key), $default);
     }
 
+    /**
+     * Get a value for the current logged-in user.
+     * @param $key
+     * @param bool $default
+     * @return bool|string
+     */
+    public function getForCurrentUser($key, $default = false)
+    {
+        return $this->getUser(user(), $key, $default);
+    }
+
     /**
      * Gets a setting value from the cache or database.
      * Looks at the system defaults if not cached or in database.