Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.3] A resource can define the route basename #16352

Merged
merged 2 commits into from
Nov 15, 2016

Conversation

shadoWalker89
Copy link
Contributor

Assuming we have a resource foo and we want to rename the route names

from foo.index to bar.index
from foo.show to bar.show
...

Instead of passing an array of all the 7 resource method names

$router->resource('foo', 'FooController', ['names' => [
    'index' => 'bar.index',
    'show' => 'bar.show',
    ...
]]);

we can just pass a string which represents the basename of the resource

$router->resource('foo', 'FooController', ['names' => 'bar']);

@taylorotwell
Copy link
Member

Why would you actually want to do this?

@shadoWalker89
Copy link
Contributor Author

Well some clients don't like the urls in english and they require them to be in french.
But for me i like the route names to be in english.
This PR make renaming the 7 REST routes easier

@spyric
Copy link
Contributor

spyric commented Nov 14, 2016

+1 to @shadoWalker89. Many times customer require to change some URLs in the end of development and it become to pain.

Maybe better will be if developer can set prefix (part before .index,.show and e.t.c) for resource

@taylorotwell taylorotwell merged commit 6c90b2d into laravel:5.3 Nov 15, 2016
@shadoWalker89 shadoWalker89 deleted the resource_basename branch November 15, 2016 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants