mirror of
https://github.com/koel/koel
synced 2024-12-30 06:23:05 +00:00
ab4f2210d1
* Add the API documentation * Apply fixes from StyleCI (#871)
35 lines
826 B
PHP
35 lines
826 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API\Download;
|
|
|
|
use App\Http\Requests\API\Download\SongRequest;
|
|
use App\Repositories\SongRepository;
|
|
use App\Services\DownloadService;
|
|
|
|
/**
|
|
* @group 6. Download
|
|
*/
|
|
class SongController extends Controller
|
|
{
|
|
private $songRepository;
|
|
|
|
public function __construct(DownloadService $downloadService, SongRepository $songRepository)
|
|
{
|
|
parent::__construct($downloadService);
|
|
$this->songRepository = $songRepository;
|
|
}
|
|
|
|
/**
|
|
* Download one or several songs.
|
|
*
|
|
* @queryParam songs array An array of song IDs
|
|
*
|
|
* @response []
|
|
*/
|
|
public function show(SongRequest $request)
|
|
{
|
|
$songs = $this->songRepository->getByIds($request->songs);
|
|
|
|
return response()->download($this->downloadService->from($songs));
|
|
}
|
|
}
|