Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix laravel 5.2 this error "Maximum function nesting level of '100' reached, aborting!"?

Tags:

php

laravel

I'm trying to reset password from laravel auto generated login/register authentication module. When i click on reset button it give me this error FatalErrorException in ClassLoader.php line 344: Maximum function nesting level of '100' reached, aborting!

I searched about it and find an accepted answer, but this answer does not work on my side i have followed the instruction. Can any one guide me it is laravel error or wamp ? and how can fix it. I would like to appreciate.

like image 728
Ayaz Ali Shah Avatar asked Feb 07 '16 13:02

Ayaz Ali Shah


1 Answers

This usually happens because you are loading the relations from the two models at once by something like $with property.

Let's say a Category hasMany Product and a Product belongsTo a Category.

If in both models you load the relations by default like this: in Product model $with=['category'], in Category model $with=['products']

This would result this infinite nesting. So, to solve this load the relations whenever wanted only.

Also this could happen with GlobalScopes and the idea is similar to $with property.

like image 195
Yamen Ashraf Avatar answered Oct 06 '22 14:10

Yamen Ashraf