koel/app/Http/Requests/API/MediaImageUpdateRequest.php
2024-07-06 17:44:52 +02:00

23 lines
488 B
PHP

<?php
namespace App\Http\Requests\API;
use App\Rules\ImageData;
abstract class MediaImageUpdateRequest extends Request
{
/** @return array<mixed> */
public function rules(): array
{
return [
$this->getImageFieldName() => ['string', 'required', new ImageData()],
];
}
public function getFileContent(): string
{
return $this->{$this->getImageFieldName()};
}
abstract protected function getImageFieldName(): string;
}