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