FEATURE: move bussiness logic out of models

This commit is contained in:
Michal Kváček
2016-10-17 01:05:20 +02:00
parent 2ded2924a1
commit e26e6fd460
46 changed files with 1069 additions and 1039 deletions
+9 -5
View File
@@ -1,6 +1,6 @@
<?php
namespace App\Models;
namespace App\Models\Templates;
use Illuminate\Database\Eloquent\Model;
@@ -10,8 +10,12 @@ use Illuminate\Database\Eloquent\Model;
class TemplatePath extends Model
{
public $timestamps = true;
protected $fillable = ['name', 'path', 'parent_id', 'namespace'];
protected $guarded = [];
protected $fillable = [
'name',
'path',
'parent_id',
'namespace'
];
/**
* In one path may be many templates
@@ -20,7 +24,7 @@ class TemplatePath extends Model
*/
public function templates()
{
return $this->hasMany('App\Models\Template', 'path');
return $this->hasMany(Template::class, 'path');
}
/**
@@ -30,6 +34,6 @@ class TemplatePath extends Model
*/
public function subdirectories()
{
return $this->hasMany('App\Models\TemplatePath', 'parent_id');
return $this->hasMany(TemplatePath::class, 'parent_id');
}
}