In Laravel 8 we can create a user with multiple posts (hasMany relation) like so:
User::factory()
->has(Post::factory()->count(3))
->create();
But I want to create 3 users, each with 3 posts. I tried the following [added times(3)]:
User::factory()
->has(Post::factory()->count(3))
->times(3)
->create();
But this doesn't work. It creates the users, but not the posts.
I tried this in a seeder, and in tinker, with the same result.
I know I can do it in a loop, but isn't there a fluent way to do it?