Skip to content

Commit

Permalink
allow string for parameters (#20531)
Browse files Browse the repository at this point in the history
  • Loading branch information
balping authored and taylorotwell committed Aug 12, 2017
1 parent d7552bb commit e44933a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Routing/PendingResourceRegistration.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ public function name($method, $name)
/**
* Override the route parameter names.
*
* @param array $parameters
* @param array|string $parameters
* @return \Illuminate\Routing\PendingResourceRegistration
*/
public function parameters(array $parameters)
public function parameters($parameters)
{
$this->options['parameters'] = $parameters;

Expand Down
9 changes: 8 additions & 1 deletion tests/Routing/RoutingRouteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ public function testResourceRoutingParameters()

$router = $this->getRouter();
$router->resource('foos', 'FooController', ['parameters' => 'singular']);
$router->resource('foos.bars', 'FooController', ['parameters' => 'singular']);
$router->resource('foos.bars', 'FooController')->parameters('singular');
$routes = $router->getRoutes();
$routes = $routes->getRoutes();

Expand All @@ -1131,6 +1131,13 @@ public function testResourceRoutingParameters()
$routes = $routes->getRoutes();

$this->assertEquals('foos/{foo}/bars/{bar}', $routes[3]->uri());

$router = $this->getRouter();
$router->resource('foos.bars', 'FooController')->parameter('foos', 'foo')->parameter('bars', 'bar');
$routes = $router->getRoutes();
$routes = $routes->getRoutes();

$this->assertEquals('foos/{foo}/bars/{bar}', $routes[3]->uri());
}

public function testResourceRouteNaming()
Expand Down

0 comments on commit e44933a

Please sign in to comment.