I want to use form model binding in Laravel. The following (simplified) example works fine:
{{ Form::model($user, array('class'=>'form-horizontal')) }}
{{ Form::token() }}
{{ Form::label('email', 'Email Address') }}
{{ Form::text('email') }}
{{ Form::close() }}
However, I want to use arrays in the name
attributes, as is pretty standard nowadays. In other words, have user[email]
as the field name, so that I get all the form elements in one array in the backend.
Is this possible with model binding? When I use {{ Form::text('user[email]') }}
the email does not get filled in. I tried adding array('user'=>$user)
in the Form::model
function in case it needed a nested value, but no luck.