I am using Laravel NestedSets for a multi-level quiz. If I put the Question Model as a Public Property I get an error ErrorException Maximum function nesting level of '512' reached, aborting!
.
I have tested this outside of Livewire and it works fine. Only does it throw this error if I am using Livewire with $question
as a public property.
If you change dump()
to dd()
it will output the data fine but obviously that kills the application and it can’t continue. The error seems to happen when render()
returns.
Quiz.php
use App\Models\QuizDataSet as QuizSet;
public $question; // this kills Livewire
class Quiz extends Component
{
public function mount() {
$this->question = QuizSet::descendantsAndSelf(1)->toTree();
dump($this->question);
}
public function render() {
return view('livewire.quiz');
}
You can try it for yourself by cloning my repo here https://github.com/jjjrmy/livewire-test
- Composer Install
- Artisan Migrate --Seed