$callsign = \DB::table('drivers')->lists('Code');
return view('spotCheck.create')->with('drivers', $callsign);
从我的视图这里是代码:
{!! Form::label('Code','Select a Driver') !!}
{!! Form::select('Code', $callsign, null, ['class' => 'form-control']) !!}
问题是我在做什么,我没有写错误和错误我的控制器如何知道在哪里填充下拉列表
答案 0 :(得分:0)
对于控制器我必须这样做
$drive = DB::table('drivers')->lists('Code');
return view('mypage',compact('drive'));
并在视图上做了这个
{!! Form::label ('Call Sign:',null, ['class'=>"control-label"])!!}
{!! Form::select('call_sign', $drive, null, ['class' => 'form-control' , 'id' => 'sel']) !!}