load(['tenant', 'items.imageAttachment']); if (! $purchase->tenant->cart_editing_policy->allowsVariantChanges()) { return $purchase; } $purchase->load([ 'items.sourceCatalogItem.itemAttributes.attribute', 'items.sourceCatalogItem.variants' => fn ($query) => $query->orderBy('id'), 'items.sourceCatalogItem.variants.inventory', 'items.sourceCatalogItem.variants.definitions' => fn ($query) => $query->orderBy('id'), 'items.sourceCatalogItem.variants.definitions.itemAttribute.attribute.options', 'items.sourceCatalogItem.variants.eventDates', 'items.sourceCatalogItem.variants.eventDate', ]); return $purchase; } }