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())) !!} 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -