The line comes in the server in the form of base64 from kanvas. A rule has been created for checking Base64.php:
namespace App\Rules; use Illuminate\Contracts\Validation\Rule; class Base64 implements Rule { public function passes($attribute, $value) { return base64_encode(base64_decode($value,true))===$value; } public function message() { return 'Неверный формат изображения!'; } } And here is the rule in ProductCreateRequest:
public function rules() { return [ 'cat' => ['required'], 'title' => ['required','max:250'], 'price' => ['required'], 'color'=>['max:100'] 'canvas_photo.*' => [new Base64] ]; } The problem is that there are several and several photos and canvases, and some of them can be empty and they, respectively, do not pass validation. How to throw out empty fields or to indicate them in some way, so that the verification would not fail because of them?