How to use a @foreach loop inside laravel Form::select element -
<select> @foreach($users $user) <option>{{$user->cus_code}} - {{$user->cus_name}}</option> @endforeach </select>
i have above working code. need use laravel form::select element.
something this....
{!!form::select('aaa',null,array({{$user->cus_code}} - {{$user->cus_name}})) !!}
is possible laravel 5???
in controller
foreach($users $user){ $users_array[$user->id] = $user->cus_code . " - " . $user->cus_name }
and can pass $users_array
view.
in view
{!!form::select('aaa', null, $users_array) !!}
Comments
Post a Comment