php - Dynamic field names in Laravel 5.1 -
i need create checkbox in laravel 5.1 name so: <input type="checkbox" name="groups[1]"> <input type="checkbox" name="groups[2]"> i using following code, doesn't work. know correct way code this? {!! form::checkbox('groups[{{ $user->id }}]', 'administrator', in_array('administrator', $user->roles()->lists('name')->toarray())) !!} the output is: <input checked="checked" name="groups[<?php echo e($user->email); ?>]" value="administrator" type="checkbox"> you cannot use blade inside php. concatinate id normal. try this: form::checkbox('groups['.$user->id.']', 'administrator', in_array('administrator', $user->roles()->lists('name')->toarray())) !!}