FEATURE: move bussiness logic out of models
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user