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

20 lines
567 B
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers\API;
use App\Http\Controllers\Controller;
use App\Http\Requests\API\UploadAlbumCoverRequest;
use App\Models\Album;
use App\Services\MediaMetadataService;
class UploadAlbumCoverController extends Controller
{
2024-03-19 22:48:12 +00:00
public function __invoke(UploadAlbumCoverRequest $request, Album $album, MediaMetadataService $metadataService)
{
$this->authorize('update', $album);
2024-03-19 22:48:12 +00:00
$metadataService->writeAlbumCover($album, $request->getFileContent());
return response()->json(['cover_url' => $album->cover]);
}
}