2017-03-10 14 views
1

私は私のナビゲーションバーから)(アクションでEventControllerを呼び出しています:EventControllerでLaravel 5:欠落引数コントローラ

<a href="{{ action('[email protected]_events',['host_id' => Auth::user()->host_id]) }}"> 

public function list_events($host_id) 
    { 
     $events = 'Hallo'; 
     return view('list_events',['$events' => $events]); 
    } 

そして、私はブラウザで開きます次のエラーが発生しました:

EventController.php行のErrorException: App \ Http \ Contrの引数1がありませんollers \ EventController :: list_events()

+0

は、あなたのルートが – mcklayin

+0

ルートファイル示し::( '/ list_events'、 'EventController @ list_events')を取得 - >ミドルウェア( 'auth'); – AppleForTheKing

+1

Alexeyの答えを見ると、 '/ list_events'の代わりに '/list_events/{host_id} 'を編集する必要があります – mcklayin

答えて

1
がへのあなたのルートを変更し

Route::get('list_events/{host_id}', '[email protected]_events')->mi‌​ddleware('auth');