mirror of
https://github.com/koel/koel
synced 2024-12-23 02:53:20 +00:00
26 lines
600 B
PHP
26 lines
600 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API\Download;
|
|
|
|
use App\Models\Playlist;
|
|
use Illuminate\Auth\Access\AuthorizationException;
|
|
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
|
|
|
class PlaylistController extends Controller
|
|
{
|
|
/**
|
|
* Download all songs in a playlist.
|
|
*
|
|
* @param Playlist $playlist
|
|
*
|
|
* @throws AuthorizationException
|
|
*
|
|
* @return BinaryFileResponse
|
|
*/
|
|
public function show(Playlist $playlist)
|
|
{
|
|
$this->authorize('owner', $playlist);
|
|
|
|
return response()->download($this->downloadService->from($playlist));
|
|
}
|
|
}
|