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

20 lines
577 B
PHP
Raw Normal View History

<?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
{
2024-03-19 22:48:12 +00:00
public function __invoke(UploadArtistImageRequest $request, Artist $artist, MediaMetadataService $metadataService)
{
$this->authorize('update', $artist);
2024-03-19 22:48:12 +00:00
$metadataService->writeArtistImage($artist, $request->getFileContent());
return response()->json(['image_url' => $artist->image]);
}
}