koel/app/Http/Controllers/Download/FavoritesController.php

27 lines
726 B
PHP
Raw Normal View History

2016-06-04 13:42:12 +00:00
<?php
namespace App\Http\Controllers\Download;
2016-06-04 13:42:12 +00:00
use App\Http\Requests\Download\Request;
2018-08-29 06:15:11 +00:00
use App\Repositories\InteractionRepository;
2018-08-22 20:25:01 +00:00
use App\Services\DownloadService;
2016-06-04 13:42:12 +00:00
class FavoritesController extends Controller
{
2021-06-05 10:47:56 +00:00
private InteractionRepository $interactionRepository;
2018-08-22 20:25:01 +00:00
2018-08-29 06:15:11 +00:00
public function __construct(DownloadService $downloadService, InteractionRepository $interactionRepository)
2018-08-22 20:25:01 +00:00
{
parent::__construct($downloadService);
2020-12-22 20:11:22 +00:00
2018-08-29 06:15:11 +00:00
$this->interactionRepository = $interactionRepository;
2018-08-22 20:25:01 +00:00
}
2018-08-18 11:51:52 +00:00
public function show(Request $request)
2016-06-04 13:42:12 +00:00
{
2018-08-29 06:15:11 +00:00
$songs = $this->interactionRepository->getUserFavorites($request->user());
2018-08-18 11:51:52 +00:00
return response()->download($this->downloadService->from($songs));
2016-06-04 13:42:12 +00:00
}
}