Du kan tjekke din foreach
ind hvis værdien af nameOfDepartment
match den fra din bruger.
<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>
For dit andet valgfelt skal du oprette et array med alle mulige værdier i din controller.
$interview = [
'' => '--- Select Interciew Mode ---',
'telephonic' => 'Telephonic',
'facetoface' => 'Face 2 face',
'skype' => 'Skype'
];
Så kan du gøre det samme som dit forrige valg :
<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>