loading...

re: Faster Eloquent Chunking VIEW POST

FULL DISCUSSION
 

Sure interesting post, but I'm against using eloquent when mass updating records as it updates one by one. I prefer to use update() on query builder, something like :

DB::table('posts')->where('published_at', '<', now())->update(['published_at' => now()]);

It will result query like this :

update `posts` set `published_at` = 2019-09-25 07:09:55 where `published_at` < 2019-09-25 07:09:55
Code of Conduct Report abuse