2024-01-03 17:02:18 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Download;
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
use App\Models\Artist;
|
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 DownloadArtistController extends Controller
|
|
|
|
{
|
2024-01-07 12:43:10 +00:00
|
|
|
/** @param User $user */
|
|
|
|
public function __invoke(
|
|
|
|
Artist $artist,
|
|
|
|
SongRepository $repository,
|
2024-01-10 23:11:45 +00:00
|
|
|
DownloadService $service,
|
2024-01-07 12:43:10 +00:00
|
|
|
Authenticatable $user
|
|
|
|
) {
|
2024-01-10 23:11:45 +00:00
|
|
|
return response()->download($service->getDownloadablePath($repository->getByArtist($artist, $user)));
|
2024-01-03 17:02:18 +00:00
|
|
|
}
|
|
|
|
}
|