diff --git a/src/Illuminate/Routing/RouteRegistrar.php b/src/Illuminate/Routing/RouteRegistrar.php index 4c8446fd0a83..1657f56527eb 100644 --- a/src/Illuminate/Routing/RouteRegistrar.php +++ b/src/Illuminate/Routing/RouteRegistrar.php @@ -29,6 +29,15 @@ class RouteRegistrar 'get', 'post', 'put', 'patch', 'delete', 'options', 'any', ]; + /** + * The attributes that are aliased. + * + * @var array + */ + protected $aliases = [ + 'name' => 'as', + ]; + /** * Create a new route registrar instance. * @@ -49,7 +58,7 @@ public function __construct(Router $router) */ public function attribute($key, $value) { - $this->attributes[$key] = $value; + $this->attributes[array_get($this->aliases, $key, $key)] = $value; return $this; } diff --git a/tests/Routing/RouteRegistrarTest.php b/tests/Routing/RouteRegistrarTest.php index 2d159af1e400..323e67e9598f 100644 --- a/tests/Routing/RouteRegistrarTest.php +++ b/tests/Routing/RouteRegistrarTest.php @@ -116,7 +116,6 @@ public function testCanRegisterGroupWithMiddleware() $this->seeMiddleware('group-middleware'); } - public function testCanRegisterGroupWithNamespace() { $this->router->namespace('App\Http\Controllers')->group(function ($router) {