]> BookStack Code Mirror - bookstack/blobdiff - app/helpers.php
Added settings helper and formatted code in some files
[bookstack] / app / helpers.php
index ead6b300810130111fc146e6923cdfe86aed4e15..f60e917c55cf5ef3656ea2e75118211dc4f43c53 100644 (file)
@@ -58,4 +58,16 @@ function userCan($permission, \BookStack\Ownable $ownable = null)
     $action = end($explodedPermission);
     $hasAccess = $restrictionService->checkIfEntityRestricted($ownable, $action);
     return $hasAccess && $hasPermission;
-}
\ No newline at end of file
+}
+
+/**
+ * Helper to access system settings.
+ * @param $key
+ * @param bool $default
+ * @return mixed
+ */
+function setting($key, $default = false)
+{
+    $settingService = app('BookStack\Services\SettingService');
+    return $settingService->get($key, $default);
+}