App\Middleware\AuthMiddleware::__invoke PHP Method

__invoke() public method

public __invoke ( $request, $response, $next )
    public function __invoke($request, $response, $next)
    {
        if (!$this->container->auth->check()) {
            $this->container->flash->addMessage('error', 'Please sign in before doing that');
            return $response->withRedirect($this->container->router->pathFor('auth.signin'));
        }
        $response = $next($request, $response);
        return $response;
    }
AuthMiddleware