爲什麼編輯過程失敗,如何在下拉菜單中顯示數據?爲什麼錯誤,調用未定義的方法Illuminate Database Query Builder :: list()
控制器:
public function edit($id)
{
$data['data_article'] = Article::find($id);
$data['tambah_author'] = \DB::table('authors')->list('username','id');
$data['id_author'] = \DB::table('authors')->list('id');
return View::make('article.edit',$data)->with('authors',$data);
}
觀點:
{{ Form::select('author',
(['0' => 'Pilih Author'] + $tambah_author),
$id_author,
['class'=>'form-control']) }}
感謝,您的幫助