Create a new redirect response to the current URI.

@param  int    $status
@param  array  $headers
@return \Illuminate\Http\RedirectResponse
340609
public function refresh($status = 302, $headers = [])
    {
        return $this->to($this->generator->getRequest()->path(), $status, $headers);
    }
312913
public function action( $action, $parameters = [], $status = 302, $headers = [] )
	{
		$path = $this->generator->action( $action, $parameters );

		return $this->to( $path, $status, $headers );
	}
1022885
protected function redirect($location = null, $statusCode = 302)
    {
        return $this->response->redirect(url($location), true, $statusCode);
    }
945674
public function toRestResponse(int$status = 200, array $headers = []): RestResponseContract
	{
		return (new Response())->setData($this->toArray())->setStatus($status)->setHeaders($headers);
	}
127709
public function respond($statusCode = 200, $headers = [], $options = 0)
    {
        $response = new JsonResponse();

        $response->setData($this->createData()->toArray());

        if (is_int($statusCode)) {
            $statusCode = function (JsonResponse $response) use ($statusCode) {
                return $response->setStatusCode($statusCode);
            };
        }

        if (is_array($headers)) {
            $headers = function (JsonResponse $response) use ($headers) {
                return $response->withHeaders($headers);
            };
        }

        if (is_int($options)) {
            $options = function (JsonResponse $response) use ($options) {
                $response->setEncodingOptions($options);

                return $response;
            };
        }

        if (is_callable($options)) {
            $options($response);
        }

        if (is_callable($statusCode)) {
            $statusCode($response);
        }

        if (is_callable($headers)) {
            $headers($response);
        }

        return $response;
    }
1122265
protected static function httpRedirect($url, $headers = [], $redirectCode = 301)
    {
        $url = new UrlObject($url);

        $headers['Location'] = $url->val();
        $response = new Response('', $redirectCode, $headers);
        $response->sendHeaders();
    }
1033078
public function createResponse($statusCode, array $headers = [], array $options = [])
    {
        $body = JsonRpc\json_encode($options);

        return new Response($statusCode, $headers, $body === false ? null : $body);
    }
1186269
public function redirect($path, $status = 301)
    {
        if (!$this->asWidget) {
            /** @var ResponseInterface $response */
            $response = (new ResponseInjector)->build();
            if (!$response) {
                throw new Exception('Component `response` not configured');
            }

            $response = $response->withStatus($status);
            $response = $response->getHeaderLine('Location: '.$path);

            return $response;
        }

        return false;
    }
149325
protected function getHttpResponse($status, array $headers = [])
    {
        if (array_key_exists($status, self::HTTP_RESPONSES)) {
            $response = self::HTTP_RESPONSES[$status];
        } else {
            $response = self::HTTP_RESPONSES[self::HTTP_NOT_IMPLEMENTED];
        }

        $handshake = [
            sprintf(self::RESPONSE_LINE_FORMAT, $status, $response),
        ];

        foreach ($headers as $name => $value) {
            $handshake[] = sprintf(self::HEADER_LINE_FORMAT, $name, $value);
        }

        return implode($handshake, "\r\n") . "\r\n\r\n";
    }
1309078
public function response($version, $status, $reason, $headers = array(), $body = '')
    {
        return new Response($status, $headers, $this->body($body), $version, $reason);
    }
1008600
public function to($path, $status = 302, $headers = array(), $secure = null)
    {
        $path = $this->generator->to($path, array(), $secure);

        return $this->createRedirect($path, $status, $headers);
    }
1180450
protected function redirectToRoute(string $route, $parameters = [], int $status = 302): RedirectResponse
    {
        return $this->redirect($this->generateUrl($route, $parameters), $status);
    }
870270
public function redirect($url, $status = 302)
    {
        if ($status != 302) {
            $this->setStatus($status);
        }
        $this->setHeader('Location', $url);
        $this->sendHeader();
    }
258478
public function redirectToAction($action, $parameters = [], $status = 302, $headers = [])
    {
        respondWith(response()->redirectToAction($action, $parameters, $status, $headers ));
    }
833678
private function send_status_headers() {
	if ($this->redirect_location) {
		if ($this->http_status == self::STATUS_OK) {
			$this->set_http_status(self::STATUS_TEMPORARY_REDIRECT);
		}
		
		header('Location: '.$this->redirect_location, $replace=true, $this->http_status);
		return;
	}
	
	http_response_code($this->http_status);
}
1328859
public static function redirect($url, array $parameters = [], int $statusCode = Response::STATUS_MOVED_PERMANENTLY) : Response
    {
        if (!empty($parameters)) {
            $url = $url . '?' . http_build_query($parameters);
        }

        $headers = new Headers();
        $headers->add(new Header('Location', $url));

        return new Response('', $statusCode, $headers);
    }
374503
public function redirectTo($path, $status = 302, $headers = array(), $secure = null)
	{
		return $this->redirector->to($path, $status, $headers, $secure);
	}