Laravel Factory отношения один ко многим

// 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