Let’s imagine the situation: you have a big database table (like 10 000 rows or bigger) and you need to run an update to one column. But you cannot run just SQL query – there is some PHP logic behind it. So foreach loop could potentially take forever or bump into a default 30-second script limit. Luckily, Laravel has a neat solution for it.
Want to add comments to your Statamic powered site? Try out Meerkat: a beautiful, full-featured comment system for Statamic. (sponsored link)
Processing big DB tables with Laravel's chunk() method
Posted on | Freek Van der Herten