public function referrer($default = null, $attributes = null)
    {
        $referrer = $_SERVER['HTTP_REFERER'] ?? null;

        // Check that referrer came from our site.
        $root = $this->rootUrl(true);
        if ($referrer) {
            // Referrer should always have host set and it should come from the same base address.
            if (stripos($referrer, $root) !== 0) {
                $referrer = null;
            }
        }

        if (!$referrer) {
            $referrer = $default ?: $this->route(true, true);
        }

        if ($attributes) {
            $referrer .= $attributes;
        }

        // Return relative path.
        return substr($referrer, strlen($root));
    }
public function referrer($default = null, $attributes = null)
    {
        $referrer = $_SERVER['HTTP_REFERER'] ?? null;

        // Check that referrer came from our site.
        $root = $this->rootUrl(true);
        if ($referrer) {
            // Referrer should always have host set and it should come from the same base address.
            if (stripos($referrer, $root) !== 0) {
                $referrer = null;
            }
        }

        if (!$referrer) {
            $referrer = $default ?: $this->route(true, true);
        }

        if ($attributes) {
            $referrer .= $attributes;
        }

        // Return relative path.
        return substr($referrer, strlen($root));
    }
public function referrer ( $ default = null , $ attributes = null ) { $ referrer = $ _SERVER [ 'HTTP_REFERER' ] ?? null ; // Check that referrer came from our site. $ root = $ this -> rootUrl ( true ) ; if ( $ referrer ) { // Referrer should always have host set and it should come from the same base address. if ( stripos ( $ referrer , $ root ) !== 0 ) { $ referrer = null ; } } if ( ! $ referrer ) { $ referrer = $ default ? : $ this -> route ( true , true ) ; } if ( $ attributes ) { $ referrer .= $ attributes ; } // Return relative path. return substr ( $ referrer , strlen ( $ root ) ) ; }
Return relative path to the referrer defaulting to current or given page.

@param string $default
@param string $attributes

@return string
Return relative path to the referrer defaulting to current or given page .