简体   繁体   中英

Laravel Elequent Model Error: Maximum function nesting level reached, aborting!”

I am running a website on Laravel and it was working fine on local system as well as on server previously.

Suddenly, this website has stopped and not working for few pages. On debugging or checking error log, I have found an error related to "Maximum function nesting level reached".

To find out for what thing, I am getting this error, i have debugged the code and found the below lines for which I am getting this error:

$customer = \App\Models\Customers\Customer::find(123);  
echo $customer->toJson();  //Getting error for this line  

Also tried to use toArray() instead of toJson() , but getting same error.

Now, I am not able to understand, why I am getting nesting level issue for just fetching only 1 record from database. Even customer table has few columns with not so much big data.

Can someone please help me? what is the reason behind the same?

Maybe it is a Webserver configuration for xdebug you can increase it with

max_nesting_level

in your xdebug.ini or whereever you configurates your xdebug

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM