koel/app/Http/Controllers/API/Download/PlaylistController.php
2016-08-03 18:42:11 +08:00

24 lines
547 B
PHP

<?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
*
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function download(Playlist $playlist)
{
$this->authorize('owner', $playlist);
return response()->download(Download::from($playlist));
}
}