koel/app/Http/Controllers/API/Download/PlaylistController.php

27 lines
580 B
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers\API\Download;
use App\Models\Playlist;
use Download;
class PlaylistController extends Controller
{
/**
* Download all songs in a playlist.
*
* @param Playlist $playlist
*
2016-08-03 10:42:11 +00:00
* @throws \Illuminate\Auth\Access\AuthorizationException
2016-08-16 15:12:35 +00:00
* @throws \Exception
2016-08-03 10:42:39 +00:00
*
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
*/
2016-08-03 10:42:11 +00:00
public function download(Playlist $playlist)
{
2016-06-04 13:29:45 +00:00
$this->authorize('owner', $playlist);
return response()->download(Download::from($playlist));
}
}