Don't boot Nova Request in the Service Provider - #35
Open
tylernathanreed wants to merge 2 commits into
Open
tylernathanreed wants to merge 2 commits into
tylernathanreed wants to merge 2 commits into
Conversation
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.
After installing this package, I ran into an issue that was a bit tricky to source, but it ultimately comes back here.
In short, the service provider for this package injects
NovaRequestas a dependency to the service provider's boot method. Booting a form request early in the lifecycle of a Laravel application causes unintended side-effects.This PR simply changes the service provider to inject the
NovaRequestinstance as its needed, which is inside of macros exclusively. In other words, until one of these macros is called, theNovaRequestinstance isn't resolved out of the container. This prevents said side-effects.Additionally, macros are loaded statically, so you don't need to register them on the
ServingNovaevent; you can just register them.