Load a Combobox with Selected Value

1

I need to edit an equipment registry that has multiple combos and when I click edit, load select already with selected selected.

I found that Laravel automatically identified but did not seem to.

I load by doing foreach in view edit (form). How to do this?

    
asked by anonymous 29.12.2016 / 11:58

1 answer

0

It would be nice to install Laravel Collective .

You will have access to the Form class.

Example of combobox filled with bank data:

Controller

$users = User::orderBy('nome')
->get()
->lists('nome', 'id');

return view('backend.cadastro')->with('users', $users');

View

{!! Form::select('usuarios', $users, VALOR_SELECIONADO) !!}

Parameters: : (NAME, ARRAY_DE_VALORES, VALUE DEFAULT, ARRAY)

Where it is written above VALOR_SELECIONADO is where you will place the value ID that has to be selected in combobox . Then you adapt to your case.

    
29.12.2016 / 12:18