Skip to content
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

Fix Collections's filter() discarding values == 0 #17653

Closed

Conversation

antonioribeiro
Copy link
Contributor

BelongsTo is not able to eager load relations when the id == 0. In my opinion $collection->filter() should not discard zeroes at all, only nulls, booleans (false) and empty strings (''). And maybe not even booleans, because false is also a value ([something_is_enabled => false]), but that's something we can probably filter using a closure.

This is a bug introduced in 5.4.

@taylorotwell
Copy link
Member

It is meant to behave like array_filter, which filters 0s.

@antonioribeiro
Copy link
Contributor Author

So the bug in BelongsTo stays?

@antonioribeiro
Copy link
Contributor Author

Meaning we cannot have an ID == 0 in our tables?
That's a huge change that some people will not be able to afford and it was not like that in 5.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants