koel/app/Http/Controllers/API/Download/FavoritesController.php
2018-08-24 17:27:19 +02:00

28 lines
743 B
PHP

<?php
namespace App\Http\Controllers\API\Download;
use App\Http\Requests\API\Download\Request;
use App\Services\DownloadService;
use App\Services\InteractionService;
class FavoritesController extends Controller
{
private $interactionService;
public function __construct(DownloadService $downloadService, InteractionService $interactionService)
{
parent::__construct($downloadService);
$this->interactionService = $interactionService;
}
/**
* Download all songs in a playlist.
*/
public function show(Request $request)
{
$songs = $this->interactionService->getUserFavorites($request->user());
return response()->download($this->downloadService->from($songs));
}
}