]> BookStack Code Mirror - bookstack/blobdiff - app/helpers.php
Fixed entities wrongly visible on 404
[bookstack] / app / helpers.php
index b5be0fd11bae196ccd085eb8e127ea3f0045d466..e68e29d132a80af4caec8084bd642e59ca6395f6 100644 (file)
@@ -37,6 +37,15 @@ function user()
     return auth()->user() ?: \BookStack\User::getDefault();
 }
 
+/**
+ * Check if current user is a signed in user.
+ * @return bool
+ */
+function signedInUser()
+{
+    return auth()->user() && !auth()->user()->isDefault();
+}
+
 /**
  * Check if the current user has a permission.
  * If an ownable element is passed in the jointPermissions are checked against
@@ -60,11 +69,12 @@ function userCan($permission, Ownable $ownable = null)
  * Helper to access system settings.
  * @param $key
  * @param bool $default
- * @return mixed
+ * @return bool|string|\BookStack\Services\SettingService
  */
-function setting($key, $default = false)
+function setting($key = null, $default = false)
 {
     $settingService = app(\BookStack\Services\SettingService::class);
+    if (is_null($key)) return $settingService;
     return $settingService->get($key, $default);
 }