1 回答
TA贡献1821条经验 获得超6个赞
您可以从您的用户中检查匹配的foreach值nameOfDepartment。
<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>
对于第二个选择字段,请在控制器中创建一个包含所有可能值的数组。
$interview = [
'' => '--- Select Interciew Mode ---',
'telephonic' => 'Telephonic',
'facetoface' => 'Face 2 face',
'skype' => 'Skype'
];
然后,您可以执行与先前选择相同的操作:
<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>
- 1 回答
- 0 关注
- 140 浏览
添加回答
举报