Replies: 1 comment
-
I've put together an implementation of this solution but would like some eyes on it before I submit a PR directly, just for review's sake. Hopefully someone would be able to take a look! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
10.44.0 added the
Collection::select()
andArr::select()
methods #49845 and 10.45.0 updated it to work with ArrayAccess #50072However, these convert any item in either an array or the Collection into an array even if it is an object. See https://github.com/laravel/framework/blob/11.x/src/Illuminate/Collections/Arr.php#L532-L533
For example, if you have an array of objects and select a single column, it will become an array of arrays.
This has caused unexpected behavior and I'm wondering a few things:
Arr::select()
(and theLazyCollection
) to return elements as objects?For example, in
illuminate/collections/Arr.php
Beta Was this translation helpful? Give feedback.
All reactions