2016-06-04 12:29:23 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\API\Download;
|
|
|
|
|
|
|
|
use App\Http\Requests\API\Download\Request;
|
|
|
|
use App\Models\Playlist;
|
|
|
|
use Download;
|
|
|
|
|
|
|
|
class PlaylistController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Download all songs in a playlist.
|
|
|
|
*
|
|
|
|
* @param Request $request
|
|
|
|
* @param Playlist $playlist
|
|
|
|
*
|
2016-06-04 14:17:24 +00:00
|
|
|
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
|
2016-06-04 12:29:23 +00:00
|
|
|
*/
|
|
|
|
public function download(Request $request, Playlist $playlist)
|
|
|
|
{
|
2016-06-04 13:29:45 +00:00
|
|
|
$this->authorize('owner', $playlist);
|
|
|
|
|
2016-06-04 12:29:23 +00:00
|
|
|
return response()->download(Download::from($playlist));
|
|
|
|
}
|
|
|
|
}
|