From 53357ad56f1098c47966f8ba5c03e16d6826c3a8 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 19 May 2015 10:59:57 +0930 Subject: [PATCH] Experimenting with some new ways to handle config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For now I’ve chucked it on Flarum\Core as a static method, but ultimately I think we will need a ConfigRepository abstraction (whether it replaces or sits underneath the Flarum\Core static method I’m not sure). Also starting to think about multisite scenarios, I think this is important. The Forum model could actually end up with a database table behind it, and each forum would have its own config settings? Haven’t really thought about it too hard yet… --- framework/core/src/Core.php | 11 +++++++++++ framework/core/src/Core/Models/Forum.php | 6 ++++++ .../Support/Extensions/ExtensionsServiceProvider.php | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/framework/core/src/Core.php b/framework/core/src/Core.php index b7d853549..83262ba9a 100644 --- a/framework/core/src/Core.php +++ b/framework/core/src/Core.php @@ -1,9 +1,20 @@ where('key', $key)->pluck('value'))) { + $value = $default; + } + + return $value; + } } diff --git a/framework/core/src/Core/Models/Forum.php b/framework/core/src/Core/Models/Forum.php index 2d160b776..7996ed5fa 100755 --- a/framework/core/src/Core/Models/Forum.php +++ b/framework/core/src/Core/Models/Forum.php @@ -1,8 +1,14 @@ where('key', 'extensions_enabled')->pluck('value'), true); + $extensions = json_decode(Core::config('extensions_enabled'), true); $providers = []; foreach ($extensions as $extension) {