public function secure(string $path = null): RedirectResponse
    {
        // If not path was set
        if (null === $path) {
            // If the uri is already set
            if (null !== $this->uri) {
                // Set the path to it
                $path = $this->uri;
            } else {
                // Otherwise set the path to the current path w/ query string
                $path = request()->getPath();
            }
        }

        // If the path doesn't start with a /
        if ('/' !== $path[0]) {
            // Set the uri as the path
            $this->setUri($path);

            // Return out of the method
            return $this;
        }

        // Set the uri to https with the host and path
        $this->setUri('https://' . request()->getHttpHost() . $path);

        return $this;
    }
public function secure(string $path = null): RedirectResponse
    {
        // If not path was set
        if (null === $path) {
            // If the uri is already set
            if (null !== $this->uri) {
                // Set the path to it
                $path = $this->uri;
            } else {
                // Otherwise set the path to the current path w/ query string
                $path = request()->getPath();
            }
        }

        // If the path doesn't start with a /
        if ('/' !== $path[0]) {
            // Set the uri as the path
            $this->setUri($path);

            // Return out of the method
            return $this;
        }

        // Set the uri to https with the host and path
        $this->setUri('https://' . request()->getHttpHost() . $path);

        return $this;
    }
public function secure ( string $ path = null ) : RedirectResponse { // If not path was set if ( null === $ path ) { // If the uri is already set if ( null !== $ this -> uri ) { // Set the path to it $ path = $ this -> uri ; } else { // Otherwise set the path to the current path w/ query string $ path = request ( ) -> getPath ( ) ; } } // If the path doesn't start with a / if ( '/' !== $ path [ 0 ] ) { // Set the uri as the path $ this -> setUri ( $ path ) ; // Return out of the method return $ this ; } // Set the uri to https with the host and path $ this -> setUri ( 'https://' . request ( ) -> getHttpHost ( ) . $ path ) ; return $ this ; }
Set the redirect uri to secure.

@param string $path The path

@return \Valkyrja\Http\RedirectResponse
Set the redirect uri to secure .