-
Notifications
You must be signed in to change notification settings - Fork 11.4k
[12.x] Make Blueprint Resolver Statically #55607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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
|
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. |
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) {
// ...
});
}); |
This reverts commit ea9c481.
Bug
The facade
\Illuminate\Support\Facades\Schema
callsdb.schema
, which is not a singleton. As a result, callingSchema::blueprintResolver
has no effect.Solution
Adding the
static
modifier will make the property accessible across all instances. Furthermore, allowingblueprintResolver
to acceptnull
values 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.