feat: add detail image media and play list

This commit is contained in:
2026-06-06 19:08:27 +03:30
parent 0b578e15dd
commit fcf9c35697
5 changed files with 91 additions and 10 deletions
+7
View File
@@ -13,6 +13,7 @@ class Media extends Model
protected $fillable = [
'user_id',
'image_id',
'detail_image_id',
'title',
'caption',
'type',
@@ -42,6 +43,12 @@ public function image()
return $this->belongsTo(Image::class);
}
// Image shown on the detail (show-by-id) screen; image() is the list thumbnail.
public function detailImage()
{
return $this->belongsTo(Image::class, 'detail_image_id');
}
public function categories()
{
return $this->belongsToMany(Category::class, 'category_media');
+7 -1
View File
@@ -15,7 +15,7 @@ class MusicPlaylist extends Model
protected $table = 'music_playlists';
protected $fillable = [
'name', 'slug', 'description', 'image_id', 'order', 'is_active'
'name', 'slug', 'description', 'image_id', 'detail_image_id', 'order', 'is_active'
];
protected $casts = [
@@ -54,6 +54,12 @@ public function image(): BelongsTo
{
return $this->belongsTo(Image::class);
}
// Image shown on the detail (show-by-id) screen; image() is the list thumbnail.
public function detailImage(): BelongsTo
{
return $this->belongsTo(Image::class, 'detail_image_id');
}
public function getActiveMusicsAttribute()
{