*/ class PostCommentFactory extends Factory { public function definition(): array { return [ 'post_id' => Post::factory(), 'user_id' => User::factory(), 'body' => $this->faker->sentence(), 'reactions' => [], ]; } public function reply(PostComment $parent): static { return $this->state(fn () => [ 'post_id' => $parent->post_id, 'parent_id' => $parent->id, ]); } }