1

I have a piece of code:

{!! Form::select('option_employee_review', old('option_employee_review', $employeeReviews), $employeeReviews, ['id' => 'option_employee_review', 'class' => 'form-control ']); !!}

It saves the value to the database correct. When i go to edit the item again the select input does not keep the old value that's in the database. How do i make it so that the select input does keep its old value.

$employeeReviews:

[
  2843 => "Medewerker review 1"
  2849 => "Medewerker review 2"
]

2 Answers2

1

I am not using your syntax, but something like this will do I think.

<option value="{{$channel->id}}" {{ (old("channel_id") == $channel->id ? "selected" : "" ) }}>{{$channel->title}}</option>
Andy Song
  • 4,404
  • 1
  • 11
  • 29
0

Second parameter to select function must be array of options.

Try changing it like this

{!! Form::select('option_employee_review', $employeeReviews, old('option_employee_review', $employeeReviews), ['id' => 'option_employee_review', 'class' => 'form-control ']); !!}

Or based on your parent object let's say employee you can try

{!! Form::select('option_employee_review', $employeeReviews, $employee->option_employee_review, ['id' => 'option_employee_review', 'class' => 'form-control ']); !!}