在我的编辑视图中,我有这样的代码
<div class="form-group">
<label class="col-md-12">Last Name</label>
<div class="col-md-12">
<input type="text" placeholder="Enter Last Name" name="lastName" class="form-control form-control-line" value="{{$profile->personal_detail['last_name']}}" required>
</div>
</div>
<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">{{ $profile->personal_profile['department'] }}
@foreach($listDepartment as $departmentList){
<option value='{{$departmentList->nameOfDepartment}}'>{{$departmentList->nameOfDepartment}}</option>
}
@endforeach
</select>
</div>
</div>
在“编辑”视图的“我的姓氏”字段中,它为我提供了数据库的姓氏,在“部门”中,它显示我部门的下拉列表,但我希望在该字段中插入部门的名称。
我怎么才能得到它??
我还有其他这样的下拉菜单
<div class="row">
<label class="col-md-6"><b> Mode </b></label>
<div class="col-md-6">
<select class="custom-select form-control col-md-12" name="mode" id="mode" required>
<option value=""> --- Select Interciew Mode --- </option>
<option value="telephonic">Telephonic</option>
<option value="facetoface">Face 2 face</option>
<option value="skype">Skype</option>
</select>
</div>
</div><hr>
这是我的控制器
public function candidateDetail($id)
{
$empDetails = User::all();
$candidateDetail = EmployeeHire::find($id);
$interview = [
'' => '--- Select Interciew Mode ---',
'telephonic' => 'Telephonic',
'facetoface' => 'Face 2 face',
'skype' => 'Skype'
];
return view('pages.candidatedetails', compact('id', 'candidateDetail', 'empDetails', 'interview'));
}
达令说