Skip to content

[4.x]: Why eagerloading automatically returns collection ? #11562

Discussion options

You must be logged in to vote

The entire motivation for adding support for collections was so there could be a consistent way of working with eager-loaded elements and normally-queried elements – see #8513.

Wouldn't it be more convenient to return an array if ->one() or ->all() is used for the query and collection if ->collect() is used.

Convenient how? You can do all the same things with a collection that you can with an array; you just get some added benefits on top of that.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jlachancekffein
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
2 participants
Converted from issue

This discussion was converted from issue #11559 on July 06, 2022 16:57.