koel/app/Http/Controllers/Download/FavoritesController.php
2020-12-22 21:11:22 +01:00

26 lines
704 B
PHP

<?php
namespace App\Http\Controllers\Download;
use App\Http\Requests\Download\Request;
use App\Repositories\InteractionRepository;
use App\Services\DownloadService;
class FavoritesController extends Controller
{
private $interactionRepository;
public function __construct(DownloadService $downloadService, InteractionRepository $interactionRepository)
{
parent::__construct($downloadService);
$this->interactionRepository = $interactionRepository;
}
public function show(Request $request)
{
$songs = $this->interactionRepository->getUserFavorites($request->user());
return response()->download($this->downloadService->from($songs));
}
}