With LaravelCollective, we can populate a form like this :
{{ Form::model($user, ['route' => ['user.update', $user->id]]) }}
If we declare an input like this (inside a view) :
{{ Form::text('name') }}
the field will be automatically filled by the attribute "$user->name".
However, if we want to add some custom parameters (like class) :
{{ Form::text('name', ['class' => 'form-control']) }}
we have the following error :
htmlspecialchars() expects parameter 1 to be string, array given
,
OK so framework is waiting for the second parameter...
{{ Form::text('name', '', ['class' => 'form-control']) }}
But in that case, we lose the "auto-populate" feature. Is there a solution to custom form fields, and keeping the auto populate functionality ?
Thanks !
Solution given by porloscerros :
{{ Form::text('name', NULL, ['class' => 'form-control']) }}