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

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -