koel/app/Http/Controllers/API/UploadPlaylistCoverController.php

23 lines
638 B
PHP
Raw Permalink Normal View History

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
) {
$this->authorize('collaborate', $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]);
}
}