2016-06-04 13:42:12 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\API\Download;
|
|
|
|
|
|
|
|
use App\Http\Requests\API\Download\Request;
|
|
|
|
use App\Models\Song;
|
2017-06-04 01:30:45 +00:00
|
|
|
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
2016-06-04 13:42:12 +00:00
|
|
|
|
|
|
|
class FavoritesController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Download all songs in a playlist.
|
|
|
|
*
|
2016-06-04 14:17:24 +00:00
|
|
|
* @param Request $request
|
2016-06-04 13:42:12 +00:00
|
|
|
*
|
2017-06-04 01:30:45 +00:00
|
|
|
* @return BinaryFileResponse
|
2016-06-04 13:42:12 +00:00
|
|
|
*/
|
2018-08-18 11:51:52 +00:00
|
|
|
public function show(Request $request)
|
2016-06-04 13:42:12 +00:00
|
|
|
{
|
2018-08-18 11:51:52 +00:00
|
|
|
$songs = Song::getFavorites($request->user());
|
|
|
|
|
|
|
|
return response()->download($this->downloadService->from($songs));
|
2016-06-04 13:42:12 +00:00
|
|
|
}
|
|
|
|
}
|