2024-02-24 15:37:01 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\API;
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
use App\Http\Requests\API\UploadPlaylistCoverRequest;
|
|
|
|
use App\Models\Playlist;
|
|
|
|
use App\Services\MediaMetadataService;
|
|
|
|
|
|
|
|
class UploadPlaylistCoverController extends Controller
|
|
|
|
{
|
|
|
|
public function __invoke(
|
|
|
|
UploadPlaylistCoverRequest $request,
|
|
|
|
Playlist $playlist,
|
|
|
|
MediaMetadataService $mediaMetadataService
|
|
|
|
) {
|
2024-07-26 12:28:11 +00:00
|
|
|
$this->authorize('own', $playlist);
|
2024-03-19 22:48:12 +00:00
|
|
|
$mediaMetadataService->writePlaylistCover($playlist, $request->getFileContent());
|
2024-02-24 15:37:01 +00:00
|
|
|
|
|
|
|
return response()->json(['cover_url' => $playlist->cover]);
|
|
|
|
}
|
|
|
|
}
|