如果验证问题,则需要Laravel

时间:2018-06-24 16:06:03

标签: laravel laravel-5 laravel-5.2 laravel-5.1

如果验证存在问题,则需要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'
    ];

验证总是失败。如果我想念什么,请建议我。

1 个答案:

答案 0 :(得分:0)

下定决心

刀片:删除了括号内的双引号。

{{ Form::text('mailgun[secret]',null,['class' => 'form-control', 'id' => 'mailgun_secret']) }}

表单请求:已删除星号

'mailgun.domain' => 'required_if:driver,mailgun'