mirror of
https://github.com/koel/koel
synced 2024-12-28 21:43:07 +00:00
ab4f2210d1
* Add the API documentation * Apply fixes from StyleCI (#871)
33 lines
842 B
PHP
33 lines
842 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API\Download;
|
|
|
|
use App\Http\Requests\API\Download\Request;
|
|
use App\Repositories\InteractionRepository;
|
|
use App\Services\DownloadService;
|
|
|
|
/**
|
|
* @group 6. Download
|
|
*/
|
|
class FavoritesController extends Controller
|
|
{
|
|
private $interactionRepository;
|
|
|
|
public function __construct(DownloadService $downloadService, InteractionRepository $interactionRepository)
|
|
{
|
|
parent::__construct($downloadService);
|
|
$this->interactionRepository = $interactionRepository;
|
|
}
|
|
|
|
/**
|
|
* Download all songs favorite'd by the current user.
|
|
*
|
|
* @response []
|
|
*/
|
|
public function show(Request $request)
|
|
{
|
|
$songs = $this->interactionRepository->getUserFavorites($request->user());
|
|
|
|
return response()->download($this->downloadService->from($songs));
|
|
}
|
|
}
|