mirror of
https://github.com/koel/koel
synced 2024-12-23 19:13:06 +00:00
27 lines
704 B
PHP
27 lines
704 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Requests\API\UploadArtistImageRequest;
|
|
use App\Models\Artist;
|
|
use App\Services\MediaMetadataService;
|
|
|
|
class UploadArtistImageController extends Controller
|
|
{
|
|
public function __invoke(
|
|
UploadArtistImageRequest $request,
|
|
Artist $artist,
|
|
MediaMetadataService $mediaMetadataService
|
|
) {
|
|
$this->authorize('update', $artist);
|
|
|
|
$mediaMetadataService->writeArtistImage(
|
|
$artist,
|
|
$request->getFileContentAsBinaryString(),
|
|
$request->getFileExtension()
|
|
);
|
|
|
|
return response()->json(['image_url' => $artist->image]);
|
|
}
|
|
}
|