I'm using rappasoft/laravel-5-boilerplate.
Have a weird issue where I'm using the 'auth' middleware for routes. Testing access to a page that requires login. When not logged in it displays the Unauthenticated exception error, and does not redirect to Login screen. In the Handler.php file unauthenticated exists and has code to redirect to the login screen, but this function is never called!
Why would the unauthenticated function not be called on the Illuminate\ Auth\AuthenticationException?? It does't make sense.
The route:
Route::group(['middleware' => 'auth'], function () {
Route::get('project/add', 'Project\ProjectController@create')-
>name('project.add');
});
Exceptions/Handler.php
protected function unauthenticated( $request, AuthenticationException $exception )
{
if ( $request->expectsJson() ) {
return response()->json( [ 'error' => 'Unauthenticated.' ], 401 );
}
return redirect()->guest( route( 'frontend.auth.login' ) );
}
And then to test, I'm simply visiting: http://px.app/project/add