我做了一個列表查詢,填充我的下拉框。我已經嘗試了控制器部件上的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