2016-06-04 12:29:23 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\API\Download;
|
|
|
|
|
|
|
|
use App\Models\Playlist;
|
2017-06-04 01:30:45 +00:00
|
|
|
use Illuminate\Auth\Access\AuthorizationException;
|
2016-06-04 12:29:23 +00:00
|
|
|
|
2018-12-09 21:24:43 +00:00
|
|
|
/**
|
|
|
|
* @group 6. Download
|
|
|
|
*/
|
2016-06-04 12:29:23 +00:00
|
|
|
class PlaylistController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
2020-04-12 08:18:17 +00:00
|
|
|
* Download a whole playlist
|
2018-12-09 21:24:43 +00:00
|
|
|
*
|
|
|
|
* @response []
|
2016-06-04 12:29:23 +00:00
|
|
|
*
|
2017-06-04 01:30:45 +00:00
|
|
|
* @throws AuthorizationException
|
2016-06-04 12:29:23 +00:00
|
|
|
*/
|
2018-08-18 11:51:52 +00:00
|
|
|
public function show(Playlist $playlist)
|
2016-06-04 12:29:23 +00:00
|
|
|
{
|
2016-06-04 13:29:45 +00:00
|
|
|
$this->authorize('owner', $playlist);
|
|
|
|
|
2018-08-18 11:51:52 +00:00
|
|
|
return response()->download($this->downloadService->from($playlist));
|
2016-06-04 12:29:23 +00:00
|
|
|
}
|
|
|
|
}
|