FEATURE: move categories into own repository

This commit is contained in:
Michal Kváček
2017-08-22 14:10:50 +02:00
commit 16471b010f
27 changed files with 679 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace Modules\Categories\Entities;
use App\Models\Content\Content;
use App\Models\Module;
use Franzose\ClosureTable\Models\Entity;
class Category extends Entity
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'categories';
public $timestamps = true;
/**
* ClosureTable model instance.
*
* @var categoryClosure
*/
protected $closure = 'Modules\Categories\Entities\CategoryClosure';
public function module()
{
return $this->belongsTo(Module::class);
}
public function content()
{
return $this->hasMany(Content::class, 'categoryId');
}
}
+14
View File
@@ -0,0 +1,14 @@
<?php
namespace Modules\Categories\Entities;
use Franzose\ClosureTable\Models\ClosureTable;
class CategoryClosure extends ClosureTable
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'category_closure';
}