0

I have an array and i use foreach, below is code

@foreach($param2 as $par)
{{$par->account}}
@endforeach

now i want to use the $par->account in drop down

i am using below code

    {!! Form::select('[
'option' => $par->account
], null, ['placeholder' => '<select>','class'=>'form-control']) !!}

there are 3 items in array, but it shows only single item.

Muhammad Kazim
  • 611
  • 2
  • 11
  • 26

1 Answers1

1

Generate array and send it from controller :

Controller :

foreach($param2 as $par) {
    $accounts[] = $par->account;
}

In view :

{!! Form::select('name', $accounts, null, ['placeholder' => '<select>','class'=>'form-control']) !!}
Misagh Laghaei
  • 1,293
  • 1
  • 14
  • 26