我有以下HTML代码,
<div class="col-md-8 address-proof">
<div class="form-check form-check-inline">
{{ Form::checkbox('Proof[]', 1, true, array('class' => 'form-check-input')) }}
<label class="form-check-label" for="Passport">Passport</label>
</div>
<div class="form-check form-check-inline conditional" data-condition="['yes'].includes(HaveAadharCard)">
{{ Form::checkbox('Proof[]', 2, false, array('class' => 'form-check-input')) }}
<label class="form-check-label" for="Adhaar">Adhaar</label>
</div>
<div class="form-check form-check-inline">
{{ Form::checkbox('Proof[]', 3, false, array('class' => 'form-check-input','id'=>'DrivingL')) }}
<label class="form-check-label" for="DL">DL </label>
</div>
<div class="form-check form-check-inline">
{{ Form::checkbox('Proof[]', 4, false, array('class' => 'form-check-input')) }}
<label class="form-check-label" for="Voter_Id">Voter ID</label>
</div>
<div class="form-check form-check-inline">
{{ Form::checkbox('Proof[]', 5, false, array('class' => 'form-check-input')) }}
<label class="form-check-label" for="NREGA">NREGA</label>
</div>
</div>
我有以下验证码,
$this->validate($request, [
'title' => 'required',
'body' => 'required',
...
'Proof' => 'required|min:2',
]);
上面的代码不起作用,我想要至少两个必填复选框。
更新:
我必须添加
{{ Form::hidden('Proof', 0) }}
字段让它发挥作用。