nova-flexible-content: validation rule images fails.
hi I have the following block
Flexible::make('Content') ->addLayout('Image - One Image', 'image_full', [ Image::make('Image')->rules('image'), ]) ->addLayout('Image - Two Image', 'image_two', [ Image::make('Image 1')->rules('image'), Image::make('Image 2')->rules('image'), ])
If i remove the ->rules('image) it works fine. Otherwise i get the error, “image must be an image” when attmpting to upload an image. Unsure about other field types but the image validation ones are failing
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 15 (5 by maintainers)
I’m experiencing a similar issue with file size validation not working inside of the flexible content field.
Image::rules->('max:1000')
does not work to limit the file size to 1000kb/1mb.Same issue here.
Hi guys ! I have a quite similar issue;
Image::make('Image', 'image')->rules('required', 'max:500')
seems to validate against the name of the image, not the image itselfHi @shindass, thanks for the insight. Re-opening this issue 😃
@Nyratas Hi Nyratas, Thank you for following up, The Nova field ‘image’ doesnt handle the file type check. and you have to use
->rules(['mimes:png,jpg,jpeg'])
in order to check the mimes. but in this case, the rule() function is not working properly in flexiable content, it always return false for any file type