Merge branch 'binarity.cz' of binarity.cz:/opt/git/internal/cms/minicms into binarity.cz

This commit is contained in:
Michal Kváček
2016-10-10 21:42:03 +02:00
4 changed files with 54 additions and 16 deletions
+8 -2
View File
@@ -2,6 +2,9 @@
namespace App\Helpers;
use App\Models\Module;
use DebugBar\Bridge\MonologCollector;
use Illuminate\Database\QueryException;
use Monolog\Logger;
class CurrentTemplate
{
@@ -10,16 +13,19 @@ class CurrentTemplate
/**
* Getter for currently set template
*
* @return Module
* @throws \ErrorException
*/
public static function get()
{
if (!self::$initialized) {
try {
self::$template = Module::where('is_template', true)
->where('enabled', true)
->first();
} catch (QueryException $e) {
throw new \ErrorException('DB not migrated, please, do so!');
}
if (self::$template) {
self::$template->module_settings = json_decode(self::$template->module_settings);
}