[12.x] Make Blueprint Resolver Statically#55607
Merged
taylorotwell merged 1 commit intolaravel:12.xfrom Apr 30, 2025
finagin:12.x
Merged
[12.x] Make Blueprint Resolver Statically#55607taylorotwell merged 1 commit intolaravel:12.xfrom finagin:12.x
taylorotwell merged 1 commit intolaravel:12.xfrom
finagin:12.x
Conversation
Member
Contributor
Author
|
Hi @taylorotwell framework/src/Illuminate/Support/Facades/Schema.php Lines 55 to 62 in f9a96f7 framework/src/Illuminate/Support/Facades/Facade.php Lines 231 to 244 in f9a96f7 |
Contributor
Author
|
I don't see the reason for prohibiting caching for this facade. However, considering that this feature first appeared for this facade, there is probably a valid reason for it. Perhaps the author of this feature can help us, @driesvints. |
Contributor
|
As a workaround, until this is published, you can call this from a Service Provider's $this->callAfterResolving('db.schema', function ($schemaBuilder) {
$schemaBuilder->blueprintResolver(function ($connection, $table, $callback) {
// ...
});
}); |
taylorotwell
added a commit
that referenced
this pull request
May 9, 2025
This reverts commit ea9c481.
taylorotwell
added a commit
that referenced
this pull request
May 9, 2025
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.

Bug
The facade
\Illuminate\Support\Facades\Schemacallsdb.schema, which is not a singleton. As a result, callingSchema::blueprintResolverhas no effect.Solution
Adding the
staticmodifier will make the property accessible across all instances. Furthermore, allowingblueprintResolverto acceptnullvalues will provide the ability to revert to the default builder if the custom builder was intended for single-use only.Compatibility
Since this functionality is currently not fully operational, fixing this bug does not pose any compatibility issues.