koel/app/Http/Controllers/Download/FavoritesController.php
2020-10-26 16:29:29 +01:00

25 lines
703 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));
}
}