M
M
MasterCopipaster2020-11-18 23:19:09
Laravel
MasterCopipaster, 2020-11-18 23:19:09

How to create a lazy collection in laravel on big data?

Hello everyone, I read the manual on lazy laravel collections, how it works with the database is clear, how it reads large files is also clear.

But if I need to generate a collection (for example, just a list of strings) that is generated in a loop but more than can be placed in ram (and not saved to the database), then how to make such a collection swap to disk? - Or is it not provided in principle? I still don't understand, to be honest, can you explain this question.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya S, 2020-11-19
@MasterCopipaster

Seems you need generators: https://www.php.net/manual/en/language.generators.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question