Skip to content

Commit

Permalink
Add name alias to RouteRegistrar
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephSilber committed Dec 4, 2016
1 parent b07b01e commit 1ebabad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/Illuminate/Routing/RouteRegistrar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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;
}
Expand Down
1 change: 0 additions & 1 deletion tests/Routing/RouteRegistrarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ public function testCanRegisterGroupWithMiddleware()
$this->seeMiddleware('group-middleware');
}


public function testCanRegisterGroupWithNamespace()
{
$this->router->namespace('App\Http\Controllers')->group(function ($router) {
Expand Down

0 comments on commit 1ebabad

Please sign in to comment.