diff options
| author | Zach DeCook <zachdecook@librem.one> | 2020-09-21 21:15:18 -0400 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2020-09-21 21:15:18 -0400 |
| commit | 247c96763c65f83fd6c28e591a6e8fe3e62780a1 (patch) | |
| tree | 353217bbdc9d2b99e6efe0232ac24e66a532c2b7 /laravel/app/Http/Controllers/PlaylistController.php | |
| parent | bfdedb8210222ae44dc9b7a7136f8774a5bc76e4 (diff) | |
| download | prosongsa-247c96763c65f83fd6c28e591a6e8fe3e62780a1.tar.gz | |
* Feature: Add to "favorites" playlist
Diffstat (limited to 'laravel/app/Http/Controllers/PlaylistController.php')
| -rw-r--r-- | laravel/app/Http/Controllers/PlaylistController.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/laravel/app/Http/Controllers/PlaylistController.php b/laravel/app/Http/Controllers/PlaylistController.php index 49b1f35..c055601 100644 --- a/laravel/app/Http/Controllers/PlaylistController.php +++ b/laravel/app/Http/Controllers/PlaylistController.php @@ -15,4 +15,16 @@ class PlaylistController extends Controller } abort(404); } + public function post($playlistName, $songID) + { + $pl = Playlist::where('name',$playlistName)->first(); + if (!$pl){ + $pl = new Playlist(); + $pl->name = $playlistName; + } + $pl->save(); + $pl->songs()->attach($songID); + // Do people want to see the favorites playlist when they've added to it, or stay on the song? + return redirect()->route('playlist.show', [ 'playlist' => $playlistName]); + } } |
