I created 3 models are Exams, Questions and Answers. I use nested eager loading to load all questions and answers of specific exams.
My function is:
public function allBy($examId)
{
return \Exam::with('questions.answers')->get();
}
It works in Laravel 5.1. Today, I upgrade my project to Laravel 5.2 by creating new project and move files to it. However, when running above function, it quit program suddenly. In client side's console window (Chrome), it displays error with status 500 (Internal Server Error).
I try to use "try...catch" but it does not go to catch. It still quit when do get() function. I don't know where is the problem.
I also try to make simple eager loading:
return \Exam::with('questions')->get();
It works in laravel 5.2.