-
Notifications
You must be signed in to change notification settings - Fork 11k
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
Resourceful URL generation #37
Comments
+1. Would be awesome to have. |
Shawn - do you think something like this would even be necessary, if the resourceful controller generator automatically created the named routes? I think I might prefer to stick with: $url = URL::to_route( 'edit_user_path', array($id) ); ...One less new thing to learn, and fully readable. |
Yea, I think you're right. On Mon, Jan 14, 2013 at 3:47 PM, Jeffrey Way [email protected]:
Shawn McCool | Big Name |
I agree, providing we have named routes for resources. Also means that Meido's HTML package can still be used to create links. |
Coming back around to this getting ready to implement something. What do you guys think about using "dot" syntax for the route names on resourceful routes? Like...
Also planning on implementing nested resources, so like:
|
I suggest dots because we use those throughout the framework for other things and to indicate nesting, etc. |
I don't think that it's a bad convention. If you create a new convention for every type of thing then you're going to run out of delimiters quickly. |
@taylorotwell Am I correct in assuming that we reference the controller method? Eg. URL::route('user.destroy', [1]); ? Just to clarify, routing to the action, not a named route variant. |
This looks cool. And I agree, dots feel right. |
@niallobrien the name happens to match the controller action, yeah, but it's a true named route. I just thought it would be convenient if they matched the action names. |
I think that would work just fine. My only concern might relate to whether it confuses people. For Or, I wonder which would be considered more readable/recognizable by the community: URL::route('user.create');
// or
URL::route('create_user'); Either way, I think both fit nicely. |
Good point @JeffreyWay. People are used to @ representing a controller action. |
Using |
This has been implemented. Resource routes also use wildcards matching the resource names so that they may be easily used with
|
@taylorotwell I noted that due to this change, I am not able to workout my api routes which is actually segmented under "api/" path for all my resources, and it is now that route::resource() no longer accept slash. |
Does that explain #182? |
…Frontend 24849 Coding Frontend
…tication-endpoints Add user + client credentials authentication endpoints
Apply fixes from StyleCI
I think that it'd be good to have the URL class able to generate resourceful links to match resourceful routing.
Maybe something like URL::resource(resource route, parameters)
Resource Routes for a user: userIndex, userCreate, userStore, userShow, userEdit, userUpdate, userDestroy
URL::resource('userCreate')
URL::resource('userEdit', $user->id)
The text was updated successfully, but these errors were encountered: