How to add a filter to a route and pass a controller to it ?.
In a Laravel document, they said that you can add a filter to the following route:
Route::get('/', array('before' => 'auth', function()
{
return 'Not Authorized';
}));
But I need to pass the controller, for example:
Route::get('/', array('before' => 'auth', 'HomeController@index'));
But I get this error when I do it like this:
call_user_func_array() expects parameter 1 to be a valid callback, no array or string given
Any idea?
source
share