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

Capture and play voice with Asterisk ARI -

c++ - Can not find the "fiostream.h" file -

visual studio - Installing Packages through Nuget - "Central Directory corrupt" -