Rename $count to $chunkSize in each()/eachById() for clarity on chunking behavior
#52879
Unanswered
Jehong-Ahn
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The
each()internally uses thechunk(). However, the variable name$countused as an argument ineach()can be misleading to users unfamiliar with the internals of Eloquent. Many may incorrectly assume that$countrefers to the iteration count, when in fact it controls the chunk size.To improve clarity, I propose renaming the
$countvariable to$chunkSize. This change would make it clear that the argument defines the size of the chunk used internally bychunk(), reducing potential confusion.I am attaching a tweet from a user who has also misunderstood the
$countparameter in theeach()method.Beta Was this translation helpful? Give feedback.
All reactions