0
我遇到的問題是我不知道如何在視圖中使用查詢的數據如果有人可以給我一個認真的想法,我使用的形式是這個,但它給我一個錯誤:將數據從查詢傳遞到視圖
我的控制器:
public function edit($id){
$datosProfesor = DB::table('profesor')->where('id', $id)->get();
$institucionDB = DB::table('institucion')->get();
$datos = array('datosProfesor' => $datosProfesor, 'institucionDB' => $institucionDB);
return view('profesorView/editarProfesor', $datos);
}
我的觀點:
<div class="form-group">
<h4>Nombre</h4>
<input type="text" name="nombre_profesor" id="nombre_profesor" class="form-control" placeholder= 'Nombre' value="{{$datosProfesor['id']}}">
</div>
,似乎我的錯誤是這樣的:
Undefined index: id (View: /var/www/html/Konecte/resources/views/profesorView/editarProfesor.blade.php)