我做了一个列表查询,填充我的下拉框。我已经尝试了控制器部件上的var_dump,并且它一切顺利,但是每当我尝试在我的刀片模板上调用我的函数时,它都会返回一个错误:Undefined variable:categories(View:C:\ wamp \ www \ airlines \ app \ views \ content \ onewayflight.blade.php)Laravel 4错误:未定义的变量
这似乎是什么问题?
OnewayflightController.php
public function onewayflight()
{
$categories = DB::table('oneways')->lists('destination-from');
return View::make('content.onewayflight')->with('destination-from', $categories);
}
onewayflight.blade.php
{{ Form::select('destination-from', $categories) }}
routes.php文件
Route::get('flight/onewayflight','[email protected]');
类似的问题:[**'如何到传递数据到视图中-laravel' **](http://stackoverflow.com/questions/18341792/如何传递数据以查看laravel) – mithunsatheesh 2014-10-03 11:03:09