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

26 lines
703 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
{
2018-08-29 06:15:11 +00:00
private $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);
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
}
}