Level 70
all() and cursor are two different things.
Normally cursor method use for reduce memory usage during fetching large amount of data.
On the other hand, all method use for fetching all the data from a particular table.
You can compare cursor and chunk.
Check this discussion: https://stackoverflow.com/questions/45467100/optimizing-code-with-chunk-or-cursor-in-laravel
9 likes