feat: add sub category for media

This commit is contained in:
2026-05-30 20:39:53 +03:30
parent 230bfc2ad8
commit 56f0e8dbe2
9 changed files with 288 additions and 24 deletions
+6
View File
@@ -14,6 +14,7 @@ class Media extends Model
'user_id',
'image_id',
'category_id',
'subcategory_id',
'title',
'caption',
'type',
@@ -48,6 +49,11 @@ public function category()
{
return $this->belongsTo(Category::class);
}
public function subCategory()
{
return $this->belongsTo(SubCategory::class, 'subcategory_id');
}
public function tags()
{
return $this->belongsToMany(Tag::class, 'media_tag');