FEATURE #1422: prepare application for registering widgets

This commit is contained in:
Michal Kváček
2016-02-15 12:19:40 +01:00
parent 677acf3dcb
commit da3046c990
10 changed files with 243 additions and 1 deletions
+21
View File
@@ -0,0 +1,21 @@
<?php
namespace App\Enumerations;
use App\Models\WidgetType;
class WidgetTypes extends BaseEnumeration
{
/**
* Init list of all installed modules
*
* @throws Exceptions\EnumerationExistsException
*/
protected static function init()
{
$widgets = WidgetType::all(['id', 'name']);
foreach ($widgets as $widget) {
self::push($widget->id, $widget->name);
}
}
}
@@ -0,0 +1,21 @@
<?php
namespace App\Enumerations;
use App\Models\WidgetType;
class WidgetTypesWithHandlers extends BaseEnumeration
{
/**
* Init list of all installed modules
*
* @throws Exceptions\EnumerationExistsException
*/
protected static function init()
{
$modules = WidgetType::all(['handler', 'name']);
foreach ($modules as $module) {
self::push($module->handler, $module->name);
}
}
}