Closed patrickrobrecht closed 7 months ago
I've updated https://github.com/spatie/laravel-query-builder/pull/902 to introduce a new method unsetDefault()
which provides the same behavior as default(null)
did before merging #895. Of course, there are tests for the new method as well.
@AlexVanderbist @Nielsvanpach Could you have a look on that?
This may be an edge case, but we may want to add some hint to the UPGRADING.md
file.
Hey, sorry about breaking backwards compatibility. This approach looks good to me, so I'll merge it in and add a disclaimer in the UPGRADING.md
. Thanks!
The changes from #895 aren't backwards compatible.
AllowedFilter::scope('test')->default('myDefaultValue')->default(null)
does not unset the default value anymore.Background: We have a static
allowedFilters
method in a model, such that we can use the same set ofAllowedFilter
s in multiple controllers:In
TestModel
:We can use the following in multiple controllers:
Removing one of the default values from the array
allowedFilters()
when using the filter worked with Laravel Query Builder 5.5.0, but not with 5.6.0:This PR introduces a new
unsetDefault()
method which could be used instead of thedefault(null)
call in the example above. This behavior is not fully backwards compatible as one should be able to expect according to Semantic Versioning used by this project.