FEATURE: move categories into own repository
This commit is contained in:
Executable
+33
@@ -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');
|
||||
}
|
||||
}
|
||||
Executable
+14
@@ -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';
|
||||
}
|
||||
Reference in New Issue
Block a user