[11.x] Execute then
Callback Before Loading web
Routes in ApplicationBuilder
#51545
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.
Summary
This pull request ensures that the
then
callback is executed before loading theweb
routes in theApplicationBuilder
. This change is necessary to prevent domain-specific routes from being overridden by the mainweb
routes.Rationale
In applications with domain-specific routing requirements, it is crucial that domain-specific routes are loaded before the general
web
routes to avoid conflicts. Executing thethen
callback before loading theweb
routes ensures that domain-specific routing logic is prioritized, improving maintainability and scalability.Changes
then
callback is now executed before loading theweb
routes in theApplicationBuilder::buildRoutingCallback
method.Testing
This change has been tested to ensure that domain-specific routes are correctly applied and that no existing functionality is broken. The following scenarios have been verified:
web
routes are loaded correctly after domain-specific routes.Additional Notes
This change does not affect existing applications that do not use domain-specific routing. It enhances flexibility for those who do, adhering to Laravel's best practices for routing.