I have an image upload field which must not be empty when another field is selected to one:
required_if:digital_form,1
But in some cases the image is already in the database, and I display it in form:
@if
<div class="col-sm-6">
<img src="{{ URL::asset($modelCycleEdit->cover) }}" alt="img" style = "max-width:200px">
{!! Form::hidden('is_cover',1) !!}
@endif
In the case the image exists I would like to void the first rule but I am not sure how to achieve this.
答案 0 :(得分:0)
尝试一下:
'image' => 'required_with:digital_form,1'
required_with ::验证中的字段必须存在,并且仅当存在任何其他指定的字段时才为空。