5 class UrlGenerator extends \Illuminate\Routing\UrlGenerator
9 * Generate an absolute URL to the given path.
13 * @param bool|null $secure
16 public function to($path, $extra = [], $secure = null)
18 $tail = implode('/', array_map(
19 'rawurlencode', (array) $this->formatParameters($extra))
22 $defaultRoot = $this->formatRoot($this->formatScheme($secure));
24 list($path, $query) = $this->extractQueryString($path);
26 return $this->formatWithBase(
27 $defaultRoot, trim($path.'/'.$tail, '/')
32 * Format the given URL segments into a single URL.
34 * @param string $defaultRoot
38 public function formatWithBase($defaultRoot, $path)
40 $isFullPath = strpos($path, 'http') === 0;
41 $setBasePath = trim(config('app.url'), '/');
47 if (! empty($setBasePath)) {
48 $defaultRoot = $setBasePath;
51 // TODO - Add mechanism to set path correctly for intended() and back() redirects
52 // TODO - Update tests to align with new system
53 // TODO - Clean up helpers and refactor their usage.
55 return trim($defaultRoot. '/' .$path, '/');