diff --git a/app/Models/Content.php b/app/Models/Content.php index 0a5384b4..4fec44d0 100644 --- a/app/Models/Content.php +++ b/app/Models/Content.php @@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\DB; use Mcamara\LaravelLocalization\Facades\LaravelLocalization; +use Modules\Categories\Entities\Category; /** * Class Content @@ -407,6 +408,11 @@ class Content extends Model return $this->belongsToMany(File::class, 'contents_has_files'); } + public function category() + { + return $this->belongsTo(Category::class); + } + /** * Save history entry into database * diff --git a/modules/Categories/Entities/Category.php b/modules/Categories/Entities/Category.php index 7f36e6cf..65cfce27 100644 --- a/modules/Categories/Entities/Category.php +++ b/modules/Categories/Entities/Category.php @@ -1,6 +1,7 @@ belongsTo(Module::class); } + + public function content() + { + return $this->hasMany(Content::class); + } }