0

I have a Laravel 5.2 application, I have a form with a lot of elements (checkboxes,selects, inputs file, input text, etc). So, I'm using the Form & HTML extension of LaravelCollective So, I'm using form::model to bind the model to the form, that's working great with all the elements except with the input text, and a email element. I have this:

{!! Form::model($mymodel,array('url'=>'myurl','method'=>'POST')) !!}
    {!!  Form::email('mail', $value = null, $attributes = array('class'=>'form-control')) !!}
    {!! Form::text('Username', '', array('class' => 'form-control')) !!}
{!! Form::close() !!}

Then, listing the attributes that I have in the model (I made dd($mymodel) and copied only the fillable):

array:25 [▼
    0 => "mail"
    1 => "Username"
  ]

The others attributes are prefilled properly, except input text and input mail.

Sredny M Casanova
  • 4,735
  • 21
  • 70
  • 115

1 Answers1

0

The field names need to match the columns in your Model. The column names are usually lower-case.

The email field should be:

Form::email('mail', null, array('class'=>'form-control'))

I.e. it should NOT have $value = null or $attributes = ...

I would also set the username field to null:

Form::text('Username', null, array('class' => 'form-control'))
Niraj Shah
  • 15,087
  • 3
  • 41
  • 60