如果验证存在问题,则需要Laravel
刀片:
{{ Form::open(['route' => ['updateEmailSettings']]) }}
<div class="form-group row">
{{ Form::label('driver','Mail Driver',['class' => 'col-md-3 col-form-label required']) }}
<div class="col-md-9">
{{ Form::select('driver',$drivers, null,['class' => 'form-control', 'placeholder' => 'Select']) }}
</div>
</div>
<div class="form-group row">
<label class="col-md-3 col-form-label font-weight-bold">Mandrill</label>
</div>
<div class="form-group row">
{{ Form::label('mailgun_secret','Secret',['class' => 'col-md-3 col-form-label']) }}
<div class="col-md-9">
{{ Form::text('mailgun["secret"]',null,['class' => 'form-control', 'id' => 'mailgun_secret']) }}
</div>
</div>
<div class="form-group row">
<div class="col-md-9 ml-md-auto">
{{ Form::button('<i class="far fa-save"></i> Save',['class'=>'btn btn-primary mr-3','type'=>'submit']) }}
<a class="btn btn-danger" href="{{ route('emailSettings') }}"><i class="far fa-times-circle"></i> Cancel</a>
</div>
</div>
{{ Form::close() }}
表单请求:
return [
'driver' => 'required',
'mailgun.*.domain' => 'required_if:driver,mailgun'
];
验证总是失败。如果我想念什么,请建议我。
答案 0 :(得分:0)
下定决心
刀片:删除了括号内的双引号。
{{ Form::text('mailgun[secret]',null,['class' => 'form-control', 'id' => 'mailgun_secret']) }}
表单请求:已删除星号
'mailgun.domain' => 'required_if:driver,mailgun'