AppleForTheKing
AppleForTheKing

Reputation: 105

Laravel 5: Missing Argument Controller

I am calling the EventController with the action() from my navbar:

<a href="{{ action('EventController@list_events',['host_id' => Auth::user()->host_id]) }}">

In the EventController:

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

And when I open it in the browser the following error occurse:

ErrorException in EventController.php line 60: Missing argument 1 for App\Http\Controllers\EventController::list_events()

Upvotes: 1

Views: 167

Answers (1)

Alexey Mezenin
Alexey Mezenin

Reputation: 163768

Change your route to:

Route::get('list_events/{host_id}', 'EventController@list_events')->mi‌​ddleware('auth'); 

Upvotes: 1

Related Questions