Form in Laravel 5.4?

1

I'm having a hard time trying to create a form in Laravel 5.4, at the time of loading View the following error appears:

  

"ErrorException in helpers.php line 532: htmlspecialchars () expects parameter 1 to be string, array given (View: /var/www/html/controle/resources/views/users/create.blade.php)"

My View looks like this:

<div>
{{ Form::open(array('url' => 'users')) }}

    <div class="form-group">
        {{ Form::label('name', 'Name') }}
        {{ Form::text('name', array('class' => 'form-control')) }}
    </div>

    <div class="form-group">
        {{ Form::label('email', 'Email') }}
        {{ Form::email('email', array('class' => 'form-control')) }}
    </div>

    <div class="form-group">
        {{ Form::label('nerd_level', 'User Level') }}
        {{ Form::select('nerd_level', array('0' => 'Nomal', '1' => 'Admin'), array('class' => 'form-control')) }}
    </div>

    {{ Form::submit('Create the User!', array('class' => 'btn btn-primary')) }}

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

Would anyone know how to fix it?

    
asked by anonymous 19.05.2017 / 21:41

1 answer

1

The second parameter of email , text or textarea will always receive the current value that fills input .

In this case, replace with Form::text('nome', null, array('class' => 'x'))

Here's a synopsis to simplify

Form::text($nome_do_campo, $valor_do_campo, $attributos)

Follow the image I removed from the documentation (future references if the documentation breaks the link):

Seethedocumentationlink:

  • link
19.05.2017 / 21:51