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

Add ability to override routes with custom paths #458

Merged
merged 7 commits into from
Apr 17, 2023

Conversation

stephenglass
Copy link
Contributor

@stephenglass stephenglass commented Apr 17, 2023

Backgroud

Fortify does not allow to specify custom paths for its built-in routes. E.g. if you want to change the endpoint name of the built-in /register route to /signup, this is the current solution:

  1. Call Fortify::ignoreRoutes() from register() in FortifyServiceProvider.php
  2. Copy all routes from Fortify routes.php into your applications web.php.
  3. Modify the endpoint names as needed.

For E-commerce in particular, you may not want a route to be named "register" as it may have some unwanted connotation depending on your product.

However, there are a few draw-backs of doing this solution.
a.) You lose some of the functionality that Fortify provides by auto-registering routes based on Feature flags and others. As your app scales and requirements change, you may finding yourself going back to implement other routes.
b.) Any future updates of Fortify routes.php will need to be manually propagated to your app code even after updating package from composer.

Proposed Solution

Allow route paths to be overridden via the fortify.php config file. Fortify routes.php will use the custom name in the config file if provided, otherwise using the default value.

Please see PR for implementation and please let me know if there's any feedback or changes that anyone would like to see!

@taylorotwell
Copy link
Member

This PR doesn't specify custom names - it specifies custom paths. Is that what you meant?

@stephenglass stephenglass changed the title Add ability to override routes with custom names Add ability to override routes with custom paths Apr 17, 2023
@stephenglass
Copy link
Contributor Author

This PR doesn't specify custom names - it specifies custom paths. Is that what you meant?

Yes, you are right. I've corrected the PR to state custom paths instead of custom names.

@taylorotwell taylorotwell merged commit c388856 into laravel:1.x Apr 17, 2023
11 checks passed
@stephenglass stephenglass deleted the custom-route-names branch April 17, 2023 18:22
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.

None yet

2 participants