praise_dare's avatar

praise_dare liked a comment+100 XP

2mos ago

@ajvanho You will have to apply the lazyById() method over a Query Builder instance not a collection, for example: Articles::where(...)->lazyById(...) It seems like you are doing something like this: $articles = Articles::where(...)->get(); $articles->lazyById(...) Hope this helps.

praise_dare's avatar

praise_dare liked a comment+100 XP

3mos ago

No wonder this is the most popular thread of all time.

From Nigeria.

praise_dare's avatar

praise_dare wrote a reply+100 XP

3mos ago

Kaduna, Nigeria.

praise_dare's avatar

praise_dare liked a comment+100 XP

3mos ago

If you are using InnoDB, then it will work properly.

Take a look at: https://github.com/laravel/framework/commit/9957329279fced0a24ac3d9d02cfe99407fa8f54

So, Laravel will recognize the nested transactions (by checking the transaction level: $this->transactions > 1) and then it will check if the savepoints are supported ($this->queryGrammar->supportsSavepoints()). MySQL/InnoDB supports savepoints: https://www.w3resource.com/mysql/mysql-transaction.php#SDT.

But I'm not sure why this isn't mentioned in the documentation...