2016-06-04 12:29:23 +00:00
|
|
|
<?php
|
|
|
|
|
2020-09-07 20:43:23 +00:00
|
|
|
namespace App\Http\Controllers\Download;
|
2016-06-04 12:29:23 +00:00
|
|
|
|
2022-07-29 06:47:10 +00:00
|
|
|
use App\Http\Controllers\Controller;
|
2016-06-04 12:29:23 +00:00
|
|
|
use App\Models\Playlist;
|
2022-07-29 06:47:10 +00:00
|
|
|
use App\Services\DownloadService;
|
2016-06-04 12:29:23 +00:00
|
|
|
|
|
|
|
class PlaylistController extends Controller
|
|
|
|
{
|
2022-07-29 06:47:10 +00:00
|
|
|
public function __construct(private DownloadService $downloadService)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-08-18 11:51:52 +00:00
|
|
|
public function show(Playlist $playlist)
|
2016-06-04 12:29:23 +00:00
|
|
|
{
|
2022-08-10 14:56:01 +00:00
|
|
|
$this->authorize('own', $playlist);
|
2016-06-04 13:29:45 +00:00
|
|
|
|
2018-08-18 11:51:52 +00:00
|
|
|
return response()->download($this->downloadService->from($playlist));
|
2016-06-04 12:29:23 +00:00
|
|
|
}
|
|
|
|
}
|