Relación de fábrica de Laravel uno a muchos
// parent factory
public function configure()
{
return $this->afterCreating(function (Category $category) {
$posts = Post::factory(50)->make();
$category->posts()->saveMany($posts);
});
}
// call in seeder
Category::factory(10)->create();
Naveed Shahzad