Laravel 5 Function () not found Laravel 5 Function () not found laravel laravel

Laravel 5 Function () not found


you forgot the uses key :

Route::get('foo/bar/{id}', ['middleware'=>'auth', 'uses'=>'FooController@show']);


If you add anything more than your controller method into your routes you need to add uses as key of the array for your controller, so for example if I don't haw any middleware it's enough to write:

Route::get('foo/bar', 'FooController@index');Route::get('foo/bar/{id}', 'FooController@show');

However if you want to add middleware you need to write:

Route::get('foo/bar', ['middleware'=>'auth','uses' => 'FooController@index']);Route::get('foo/bar/{id}', ['middleware'=>'auth','uses' => 'FooController@show']);


In case you don't use a controller for your view and you just want to display the view, you should do this:

Route::get('foo/bar', ['middleware' => 'auth', function () {    return View::make('path.to.your.page');}]);