Document middleware on native routes - #474
Open
shanerbaner82 wants to merge 2 commits into
Open
Conversation
Covers how `Route::native()->middleware()` and route groups apply on every navigation, what the synthesized request does and does not carry, which request-lifecycle middleware is skipped and how to opt your own out, how a refusal maps onto native navigation, and why `Native::visit()` rather than `Native::test()` is what exercises a guard. Pairs with NativePHP/mobile-air#252.
The route is bound to the synthesized request, not merely resolvable, so route parameters and route-model binding work — worth stating, since SubstituteBindings runs on every navigation. That happens more often than the previous wording implied: registering native routes through `withRouting(web: routes/mobile.php)` puts every one of them in the `web` group, so anything an app has added to that group runs per navigation too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Pairs with NativePHP/mobile-air#252 / NativePHP/mobile-air#348, which makes
Route::native()->middleware()run on every navigation rather than only on cold start.New page at
the-basics/middleware(order 153, right after Routing), plus a pointer to it from the Routing page's "Registering routes" section.Covers:
->middleware()and route groups, both of which now work unchangedScreenGuard::skip()for opting your own outNative::visit()exercises a guard andNative::test()deliberately doesn't — the distinction that let this bug hide from an otherwise thorough suiteShould land with (or just after) the mobile-air PR, since it documents behavior that doesn't exist yet.