Hi Lagobx,
Thanks for the answer. I re-tried this morning and everything was fine. I thought I was crazy yesterday but I found what broke up the form. If the name of the checkbox is roles[] then it returns true every time. But if I change it for rolescheck[] it is ok. May be a stupid, but do you know why ? Here is the code :
{!! Form::label('role_id', 'Roles:') !!}
<br/>
@foreach($roles as $keyrole => $role)
{!! Form::checkbox('rolescheck[]', $keyrole, (false !== $user->is($role)) ? 'true' : '' ) !!} {!! $role !!} (input name : rolescheck[] )
<br/>
{!! Form::checkbox('roles[]', $keyrole, (false !== $user->is($role)) ? true : '' ) !!} {!! $role !!} (input name roles[] )
<br/><br/>
@endforeach
And here is the output :
<label for="role_id">Roles:</label>
<input name="rolescheck[]" type="checkbox" value="1"> Administrator (input name : rolescheck[] )
<input checked="checked" name="roles[]" type="checkbox" value="1"> Administrator (input name roles[] )
<input checked="checked" name="rolescheck[]" type="checkbox" value="2"> Editor (input name : rolescheck[] )
<input checked="checked" name="roles[]" type="checkbox" value="2"> Editor (input name roles[] )
<input name="rolescheck[]" type="checkbox" value="3"> User (input name : rolescheck[] )
<input checked="checked" name="roles[]" type="checkbox" value="3"> User (input name roles[] )
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community