2016-06-02 17:53:26 +00:00
|
|
|
<?php
|
|
|
|
|
2020-09-07 20:43:23 +00:00
|
|
|
namespace App\Http\Controllers\Download;
|
2016-06-02 17:53:26 +00:00
|
|
|
|
2020-09-07 20:43:23 +00:00
|
|
|
use App\Http\Requests\Download\SongRequest;
|
2018-08-29 06:15:11 +00:00
|
|
|
use App\Repositories\SongRepository;
|
|
|
|
use App\Services\DownloadService;
|
2016-06-02 17:53:26 +00:00
|
|
|
|
|
|
|
class SongController extends Controller
|
|
|
|
{
|
2018-08-29 06:15:11 +00:00
|
|
|
private $songRepository;
|
|
|
|
|
|
|
|
public function __construct(DownloadService $downloadService, SongRepository $songRepository)
|
|
|
|
{
|
|
|
|
parent::__construct($downloadService);
|
|
|
|
$this->songRepository = $songRepository;
|
|
|
|
}
|
|
|
|
|
2018-08-18 11:51:52 +00:00
|
|
|
public function show(SongRequest $request)
|
2016-06-02 17:53:26 +00:00
|
|
|
{
|
2018-08-29 06:15:11 +00:00
|
|
|
$songs = $this->songRepository->getByIds($request->songs);
|
2016-06-02 17:53:26 +00:00
|
|
|
|
2018-08-18 11:51:52 +00:00
|
|
|
return response()->download($this->downloadService->from($songs));
|
2016-06-02 17:53:26 +00:00
|
|
|
}
|
|
|
|
}
|