whereDoesntHave('variants') ->each(function (Product $product): void { foreach (['S', 'M', 'L'] as $size) { ProductVariant::factory()->create([ 'product_id' => $product->id, 'name' => $size, ]); } }); } }