Are you using Laravel 5 or 4?
In Laravel 5 it got changed to middleware so instead of
'before' => 'auth'
you would use
'middleware' => 'auth'
or you can use the following method inside of the Controller:
$this->middleware('auth');
Thank you for your kindness.
Now it seems to work. But I got an Error.
ErrorException in Pipeline.php line 124:
call_user_func_array() expects parameter 1 to be a valid callback, class 'Illuminate\Support\Facades\Auth' does not have a method 'handle'
in Pipeline.php line 124
at HandleExceptions->handleError('2', 'call_user_func_array() expects parameter 1 to be a valid callback, class 'Illuminate\Support\Facades\Auth' does not have a method 'handle'', 'C:\wamp\www\hellolaravel\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php', '124', array('passable' => object(Request), 'stack' => object(Closure), 'pipe' => 'Auth', 'name' => 'Auth', 'parameters' => array()))
at call_user_func_array(array(object(Auth), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Router.php line 706
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 671
at Router->dispatchToRoute(object(Request)) in Router.php line 631
at Router->dispatch(object(Request)) in Kernel.php line 236
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 50
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 54
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 122
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
at Kernel->handle(object(Request)) in index.php line 54
Hi,
i hope you resolved your problem, just faced the error and my error was I used 'middleware' => 'Auth' with uppercase instead of 'middleware' => 'auth'.
hoping this will be helpfull
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community