Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image field in edit mode still asking for image as a 'required' field

In the voyager backend, i set an image field as required in the BREAD section:

enter image description here

This works well in 'add' mode. image field will be validated if empty

Issue occurs in 'edit' mode. The image appears but on clicking on 'save', a prompt is thrown indicating the image field is empty(therefore requiring the image to be uploaded again):

enter image description here

therefore getting an 'Image field is required' prompt on edit. this appears to be a bug. Anyone experienced this issue and how did you fix it?

like image 997
suo Avatar asked Jan 02 '23 21:01

suo


1 Answers

Found a solution from the ticket i had raised on Voyager's github's page:

i.e. using required_if instead of required

{ "validation": { "rule": "required_if:id,null", "messages": { "required": "your message" } } }

here's the ticket: Voyager image edit issue

like image 128
suo Avatar answered Jan 04 '23 11:01

suo