public function link($params = [], $options = [])
    {
        $defaults = [
            'absolute' => false,
            'basePath' => '',
            'query'    => '',
            'fragment' => ''
        ];

        $options = array_filter($options, function($value) { return $value !== '*'; });
        $options += $defaults;

        $params = $params + $this->params;

        $link = $this->_link($this->token(), $params);

        $basePath = trim($options['basePath'], '/');
        if ($basePath) {
            $basePath = '/' . $basePath;
        }
        $link = isset($link) ? ltrim($link, '/') : '';
        $link = $basePath . ($link ? '/' . $link : $link);
        $query = $options['query'] ? '?' . $options['query'] : '';
        $fragment = $options['fragment'] ? '#' . $options['fragment'] : '';

        if ($options['absolute']) {
            if ($host = $this->host()) {
                $link = $host->link($params, $options) . "{$link}";
            } else {
                $scheme = !empty($options['scheme']) ? $options['scheme'] . '://' : '//';
                $host = isset($options['host']) ? $options['host'] : 'localhost';
                $link = "{$scheme}{$host}{$link}";
            }
        }

        return $link . $query . $fragment;
    }
public function link($params = [], $options = [])
    {
        $defaults = [
            'absolute' => false,
            'basePath' => '',
            'query'    => '',
            'fragment' => ''
        ];

        $options = array_filter($options, function($value) { return $value !== '*'; });
        $options += $defaults;

        $params = $params + $this->params;

        $link = $this->_link($this->token(), $params);

        $basePath = trim($options['basePath'], '/');
        if ($basePath) {
            $basePath = '/' . $basePath;
        }
        $link = isset($link) ? ltrim($link, '/') : '';
        $link = $basePath . ($link ? '/' . $link : $link);
        $query = $options['query'] ? '?' . $options['query'] : '';
        $fragment = $options['fragment'] ? '#' . $options['fragment'] : '';

        if ($options['absolute']) {
            if ($host = $this->host()) {
                $link = $host->link($params, $options) . "{$link}";
            } else {
                $scheme = !empty($options['scheme']) ? $options['scheme'] . '://' : '//';
                $host = isset($options['host']) ? $options['host'] : 'localhost';
                $link = "{$scheme}{$host}{$link}";
            }
        }

        return $link . $query . $fragment;
    }
public function link ( $ params = [ ] , $ options = [ ] ) { $ defaults = [ 'absolute' => false , 'basePath' => '' , 'query' => '' , 'fragment' => '' ] ; $ options = array_filter ( $ options , function ( $ value ) { return $ value !== '*' ; } ) ; $ options += $ defaults ; $ params = $ params + $ this -> params ; $ link = $ this -> _link ( $ this -> token ( ) , $ params ) ; $ basePath = trim ( $ options [ 'basePath' ] , '/' ) ; if ( $ basePath ) { $ basePath = '/' . $ basePath ; } $ link = isset ( $ link ) ? ltrim ( $ link , '/' ) : '' ; $ link = $ basePath . ( $ link ? '/' . $ link : $ link ) ; $ query = $ options [ 'query' ] ? '?' . $ options [ 'query' ] : '' ; $ fragment = $ options [ 'fragment' ] ? '#' . $ options [ 'fragment' ] : '' ; if ( $ options [ 'absolute' ] ) { if ( $ host = $ this -> host ( ) ) { $ link = $ host -> link ( $ params , $ options ) . "{$link}" ; } else { $ scheme = ! empty ( $ options [ 'scheme' ] ) ? $ options [ 'scheme' ] . '://' : '//' ; $ host = isset ( $ options [ 'host' ] ) ? $ options [ 'host' ] : 'localhost' ; $ link = "{$scheme}{$host}{$link}" ; } } return $ link . $ query . $ fragment ; }
Returns the route's link.

@param  array  $params  The route parameters.
@param  array  $options Options for generating the proper prefix. Accepted values are:
- `'absolute'` _boolean_: `true` or `false`.
- `'scheme'`   _string_ : The scheme.
- `'host'`     _string_ : The host name.
- `'basePath'` _string_ : The base path.
- `'query'`    _string_ : The query string.
- `'fragment'` _string_ : The fragment string.
@return string          The link.
Returns the route s link .