Collection value() method does not return valid falsey values like '0' or 0 or false. #55734
Replies: 4 comments
-
Initially this returned USD because it loosely compared the value with true. Then they changed it or at least tried to. There is an issue or discussion that we can't find atm about this. |
Beta Was this translation helpful? Give feedback.
-
I believe this is an issue, as the Collection::value() method doesn't return false values like '0', 0, or false even when a match exists. I've opened a PR to address it and am open to any feedback or suggestions! PR: #55512 |
Beta Was this translation helpful? Give feedback.
-
Related: |
Beta Was this translation helpful? Give feedback.
-
This value method usage on a collection is not intuitive. Why are people using: get column value from a collection of rows and expect only one value and not a list of column values?
|
Beta Was this translation helpful? Give feedback.
-
Laravel Version
12.13.0
PHP Version
8.3.13
Database Driver & Version
No response
Description
The Collection
value()
method fails to return falsey values such as '0', 0, or false, even when a matching item exists in the collection.Steps To Reproduce
Beta Was this translation helpful? Give feedback.
All reactions