Problems with the validation of the fields of the forms

0

I am using Laravel 5.6.13 and Infiom to generate the CRUDs but I have a problem when it comes to the validations that are made in the same form, as the mail can not be repeated or empty fields, etc. I give you an example of the user management part. these are the fields

<div class="form-group col-sm-6">
    {!! Form::label('name', 'Name:') !!}
    {!! Form::text('name', null, ['class' => 'form-control']) !!}
</div>

<!-- Email Field -->
<div class="form-group col-sm-6">
    {!! Form::label('email', 'Email:') !!}
    {!! Form::email('email', null, ['class' => 'form-control']) !!}
</div>

and this is the view

<div class="box-body">
            <div class="row">
                {!! Form::open(['route' => 'users.store']) !!}

                    @include('users.fields')

                {!! Form::close() !!}
            </div>
        </div>

How do I make mistakes in the fields?

    
asked by Luis Dariel Valenciano 09.05.2018 в 18:21
source

1 answer

0

I solved it using the format that laravel implements by default is not exactly what I wanted but it works

<div class="form-group col-sm-6 has-feedback{{ $errors->has('email') ? ' has-error' : '' }}">
    {!! Form::label('email', 'Correo:') !!}
    <input type="email" class="form-control" name="email" value="{{ old('email') }}" placeholder="Email">
    <span class=" form-control-feedback"></span>

    @if ($errors->has('email'))
        <span class="help-block">
                        <strong>{{ $errors->first('email') }}</strong>
                    </span>
    @endif
</div>
    
answered by 09.05.2018 в 20:55