Level 2
I have found the problem. I think the if(!static::$quiz) is stopping the execution
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I tried to make one record of data that will have 3 children. The record is created but no children added. I don't see where is the problem. Maybe you can see.
public function setUp() { parent::setUp();
if(!static::$quiz){
static::$quiz = factory(Quiz::class, 1)
->create()
->each(function(Quiz $quiz){
factory(\App\Question::class, 3)
->create(['quiz_id'=> $quiz->id]);
}
);
}
}
Please or to participate in this conversation.