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

20 lines
557 B
PHP
Raw Normal View History

2024-01-03 17:02:18 +00:00
<?php
namespace App\Http\Controllers\Download;
use App\Http\Controllers\Controller;
use App\Models\Album;
2024-01-07 12:43:10 +00:00
use App\Models\User;
use App\Repositories\SongRepository;
2024-01-03 17:02:18 +00:00
use App\Services\DownloadService;
2024-01-07 12:43:10 +00:00
use Illuminate\Contracts\Auth\Authenticatable;
2024-01-03 17:02:18 +00:00
class DownloadAlbumController extends Controller
{
2024-01-07 12:43:10 +00:00
/** @param User $user */
public function __invoke(Album $album, SongRepository $repository, DownloadService $download, Authenticatable $user)
2024-01-03 17:02:18 +00:00
{
2024-01-07 12:43:10 +00:00
return response()->download($download->from($repository->getByAlbum($album, $user)));
2024-01-03 17:02:18 +00:00
}
}