app = $app; $this->authenticate = $authenticate; } public function handle($request, Closure $next, $scopesString = null) { if ($this->app->environment() !== 'testing') { try { return $this->authenticate->handle($request, $next, 'api'); } catch (AuthenticationException $e) { throw new UnauthorizedHttpException('Challenge'); } } return $next($request); } }