Skip to content

Instantly share code, notes, and snippets.

@anaxamaxan
Created August 22, 2014 01:11
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anaxamaxan/8df15263e9f25cda9872 to your computer and use it in GitHub Desktop.
Save anaxamaxan/8df15263e9f25cda9872 to your computer and use it in GitHub Desktop.
Allow curly braces in Laravel URL::route() parameters array
<?php namespace Cego\Facades;
class URL extends \Illuminate\Support\Facades\URL
{
public static function route($name, $parameters = array(), $absolute = true, $route = null)
{
$urlGenerator = static::$app['url'];
/* @var \Illuminate\Routing\UrlGenerator $urlGenerator */
$route = $urlGenerator->route($name, $parameters, $absolute, $route);
//untranslate the { and } characters.
return str_replace(['%7B','%7D'],['{','}'],$route);
}
}
@OzanKurt
Copy link

OzanKurt commented Sep 8, 2019

This is absolutely needed in core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment