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
+35
View File
@@ -0,0 +1,35 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class CustomFieldType
*/
class Template extends Model
{
public $timestamps = true;
protected $fillable = [
'template_name',
'name',
'path',
'description',
'editable'
];
protected $guarded = [];
const EDITED_TEMPLATES_DIRECTORY = 'custom';
const TEMPLATE_SUFFIX = '.blade.php';
/**
* In one path may be many templates
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function template()
{
return $this->belongsTo('App\Models\TemplatePath', 'id');
}
}
+10 -1
View File
@@ -10,6 +10,15 @@ use Illuminate\Database\Eloquent\Model;
class TemplatePath extends Model
{
public $timestamps = true;
protected $fillable = ['name'];
protected $fillable = ['name', 'path', 'parent_id', 'namespace'];
protected $guarded = [];
/**
* In one path may be many templates
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function templates() {
return $this->hasMany('App\Models\Template', 'path');
}
}