2016-06-02 17:53:26 +00:00
|
|
|
<?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.
|
|
|
|
*
|
2016-06-04 17:10:29 +00:00
|
|
|
* @param SongRequest $request
|
2016-06-02 17:53:26 +00:00
|
|
|
*
|
2016-06-04 14:17:24 +00:00
|
|
|
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
|
2016-06-02 17:53:26 +00:00
|
|
|
*/
|
|
|
|
public function download(SongRequest $request)
|
|
|
|
{
|
|
|
|
$songs = Song::whereIn('id', $request->songs)->get();
|
|
|
|
|
|
|
|
return response()->download(Download::from($songs));
|
|
|
|
}
|
|
|
|
}
|