feat: add save feature
This commit is contained in:
+11
-3
@@ -10,10 +10,11 @@
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany; // ← Add this
|
||||
use App\Traits\HasRatings;
|
||||
use App\Traits\HasComments;
|
||||
use App\Traits\HasSaves;
|
||||
|
||||
class Music extends Model
|
||||
{
|
||||
use HasFactory, HasRatings, HasComments;
|
||||
use HasFactory, HasRatings, HasComments , HasSaves;
|
||||
protected $table = 'music';
|
||||
|
||||
|
||||
@@ -43,10 +44,17 @@ public function tags(): BelongsToMany
|
||||
return $this->belongsToMany(Tag::class, 'music_tags');
|
||||
}
|
||||
|
||||
protected $appends = ['url', 'image_url' , 'average_rating', 'user_rating', 'comments_count' , 'has_user_commented',
|
||||
protected $appends = ['url',
|
||||
'image_url' ,
|
||||
'average_rating',
|
||||
'user_rating',
|
||||
'comments_count' ,
|
||||
'has_user_commented',
|
||||
'user_comment',
|
||||
'user_comment_id',
|
||||
'has_user_rated'
|
||||
'has_user_rated' ,
|
||||
'is_saved',
|
||||
'saved_count'
|
||||
];
|
||||
|
||||
public function getUrlAttribute()
|
||||
|
||||
Reference in New Issue
Block a user