]> BookStack Code Mirror - bookstack/blobdiff - app/Settings/SettingService.php
Guest create page: name field autofocus
[bookstack] / app / Settings / SettingService.php
index f2c4c8305c47c2db227a79456e880422171dc500..9f0a41ea2fceb228bde62b8ad687ac502eb7a9b4 100644 (file)
@@ -194,6 +194,8 @@ class SettingService
 
     /**
      * Put a user-specific setting into the database.
+     * Can only take string value types since this may use
+     * the session which is less flexible to data types.
      */
     public function putUser(User $user, string $key, string $value): bool
     {
@@ -206,6 +208,16 @@ class SettingService
         return $this->put($this->userKey($user->id, $key), $value);
     }
 
+    /**
+     * Put a user-specific setting into the database for the current access user.
+     * Can only take string value types since this may use
+     * the session which is less flexible to data types.
+     */
+    public function putForCurrentUser(string $key, string $value)
+    {
+        return $this->putUser(user(), $key, $value);
+    }
+
     /**
      * Convert a setting key into a user-specific key.
      */