All individual subscriptions are 50% off this week only!

3 years ago

Form select box {!!Form::select()!!}

Posted 3 years ago by Ober4You

I'm using Laravel Collective Form builder in my view and i'm populating this select box from a table in my DB like this

{!!Form::select('worktype_id[]', $worktypes_list, null, ['class' => 'form-control'])!!}

In my controller i have this for populating that select box

$worktypes_list = Worktype::lists('id', 'name');
return view('edit')->compact(''worktypes_list');

Now when i want to edit the selected item is always the first one and it should be the one that is saved in DB.

How to make selected item to be the one which is saved in DB?

Please sign in or create an account to participate in this conversation.