Możesz sprawdzić w swoim foreach
jeśli wartość nameOfDepartment
dopasuj ten od użytkownika.
<div class="form-group">
<label class="col-md-12">Department</label>
<div class="col-md-12">
<select class="custom-select form-control col-md-11" id="department" name="department">
@foreach($listDepartment as $departmentList)
@if ($profile->personal_profile['department'] == $departmentList->nameOfDepartment)
<option value="{{$departmentList->nameOfDepartment}}" selected="selected">{{$departmentList->nameOfDepartment}}</option>
@else
<option value="{{$departmentList->nameOfDepartment}}">{{$departmentList->nameOfDepartment}}</option>
@endif
@endforeach
</select>
</div>
</div>
Dla drugiego pola wyboru utwórz tablicę ze wszystkimi możliwymi wartościami w kontrolerze.
$interview = [
'' => '--- Select Interciew Mode ---',
'telephonic' => 'Telephonic',
'facetoface' => 'Face 2 face',
'skype' => 'Skype'
];
Następnie możesz zrobić to samo, co poprzednio :
<select class="custom-select form-control col-md-12" name="mode" id="mode" required>
@foreach($interview as $key => $name)
@if ($profile->personal_profile['interview'] == $key)
<option value="{{ $key }}" selected="selected">{{ $name }}</option>
@else
<option value="{{ $key }}">{{ $name }}</option>
@endif
@endforeach
</select>