我使用导航栏中的action()调用EventController:
<a href="{{ action('EventController@list_events',['host_id' => Auth::user()->host_id]) }}">
在EventController中:
public function list_events($host_id)
{
$events = 'Hallo';
return view('list_events',['$events' => $events]);
}
当我在浏览器中打开它时,出现以下错误:
EventController.php第60行中的ErrorException:缺少参数1 应用\ HTTP \控制器\ EventController :: list_events()
答案 0 :(得分:1)
将您的路线更改为:
Route::get('list_events/{host_id}', 'EventController@list_events')->middleware('auth');