Add ability to override routes with custom paths #458
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:Fortify::ignoreRoutes()
fromregister()
inFortifyServiceProvider.php
routes.php
into your applicationsweb.php
.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. Fortifyroutes.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!