Backend for songs.zachdecook.com
Diffstat (limited to 'laravel/app/Playlist.php')
-rw-r--r--laravel/app/Playlist.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/laravel/app/Playlist.php b/laravel/app/Playlist.php
index 7284b0e..f56e1be 100644
--- a/laravel/app/Playlist.php
+++ b/laravel/app/Playlist.php
@@ -11,4 +11,14 @@ class Playlist extends Model
{
return $this->belongsToMany('App\Song');
}
+ public function getM3uAttribute()
+ {
+ $output = "#EXTM3U\n";
+ foreach($this->songs as $song) {
+ if ($song->audio){
+ $output .= config('app.url') . $song->audio . "\n";
+ }
+ }
+ return $output;
+ }
}