feat: add total duration for playlist
This commit is contained in:
@@ -71,4 +71,10 @@ public function getTotalDurationAttribute()
|
||||
{
|
||||
return $this->musics()->where('music.is_active', true)->sum('music.duration');
|
||||
}
|
||||
|
||||
// Total play time of the playlist = sum of its active musics' durations.
|
||||
public function getDurationAttribute()
|
||||
{
|
||||
return $this->total_duration;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user