mirror of
https://github.com/koel/koel
synced 2024-12-23 19:13:06 +00:00
24 lines
543 B
PHP
24 lines
543 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
|
|
*
|
|
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
|
|
*/
|
|
public function download(SongRequest $request)
|
|
{
|
|
$songs = Song::whereIn('id', $request->songs)->get();
|
|
|
|
return response()->download(Download::from($songs));
|
|
}
|
|
}
|