FEATURE #1453: add registration of templates

This commit is contained in:
Michal Kváček
2016-02-18 16:28:32 +01:00
parent 214cc9f3f9
commit 66c9d7907a
9 changed files with 457 additions and 1 deletions
+23
View File
@@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: michal
* Date: 18.2.16
* Time: 10:33
*/
namespace App\Enumerations;
use App\Models\TemplatePath;
class TemplatePaths extends BaseEnumeration
{
protected static function init()
{
$paths = TemplatePath::all(['id', 'path']);
foreach ($paths as $path) {
self::push($path->id, $path->path);
}
}
}
@@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: michal
* Date: 18.2.16
* Time: 10:33
*/
namespace App\Enumerations;
use App\Models\TemplatePath;
class TemplatePathsHumanReadable extends BaseEnumeration
{
protected static function init()
{
$paths = TemplatePath::all(['id', 'name']);
foreach ($paths as $path) {
self::push($path->id, $path->name);
}
}
}
@@ -0,0 +1,25 @@
<?php
/**
* Created by PhpStorm.
* User: michal
* Date: 18.2.16
* Time: 10:33
*/
namespace App\Enumerations;
use App\Models\TemplatePath;
class TemplatePathsHumanReadableRootOnly extends BaseEnumeration
{
protected static function init()
{
$paths = TemplatePath::where('parent_id', null)
->select(['id', 'name'])
->get();
foreach ($paths as $path) {
self::push($path->id, $path->name);
}
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
/**
* Created by PhpStorm.
* User: michal
* Date: 18.2.16
* Time: 15:50
*/
namespace App\Enumerations;
use App\Models\Template;
class Templates extends BaseEnumeration
{
protected static function init()
{
$templates = Template::all(['id', 'template_name']);
foreach ($templates as $template) {
self::push($template->id, $template->template_name);
}
}
}