mirror of
https://github.com/koel/koel
synced 2024-12-23 02:53:20 +00:00
26 lines
576 B
PHP
26 lines
576 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API\Download;
|
|
|
|
use App\Http\Requests\API\Download\SongRequest;
|
|
use App\Models\Song;
|
|
use Download;
|
|
|
|
class SongController extends Controller
|
|
{
|
|
/**
|
|
* Download a song or multiple songs.
|
|
*
|
|
* @param SongRequest $request
|
|
*
|
|
* @throws \Exception
|
|
*
|
|
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
|
|
*/
|
|
public function download(SongRequest $request)
|
|
{
|
|
$songs = Song::whereIn('id', $request->songs)->get();
|
|
|
|
return response()->download(Download::from($songs));
|
|
}
|
|
}
|