koel/app/Http/Controllers/API/Download/FavoritesController.php
2018-08-29 13:15:23 +07: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));
}
}