koel/app/Http/Controllers/Download/SongController.php
2022-07-29 09:04:44 +02:00

22 lines
575 B
PHP

<?php
namespace App\Http\Controllers\Download;
use App\Http\Controllers\Controller;
use App\Http\Requests\Download\SongRequest;
use App\Repositories\SongRepository;
use App\Services\DownloadService;
class SongController extends Controller
{
public function __construct(private DownloadService $downloadService, private SongRepository $songRepository)
{
}
public function show(SongRequest $request)
{
$songs = $this->songRepository->getByIds($request->songs);
return response()->download($this->downloadService->from($songs));
}
}