FEATURE: add relationship methods to categories and content
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace Modules\Categories\Entities;
|
||||
|
||||
use App\Models\Content;
|
||||
use App\Models\Module;
|
||||
use Franzose\ClosureTable\Models\Entity;
|
||||
|
||||
@@ -12,9 +13,7 @@ class Category extends Entity implements CategoryInterface
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'categories';
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
/**
|
||||
* ClosureTable model instance.
|
||||
*
|
||||
@@ -22,7 +21,13 @@ class Category extends Entity implements CategoryInterface
|
||||
*/
|
||||
protected $closure = 'Modules\Categories\Entities\CategoryClosure';
|
||||
|
||||
public function module() {
|
||||
public function module()
|
||||
{
|
||||
return $this->belongsTo(Module::class);
|
||||
}
|
||||
|
||||
public function content()
|
||||
{
|
||||
return $this->hasMany(Content::class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user