From 5e684c6c022d53bcac25b097219fb12f08fcea8e Mon Sep 17 00:00:00 2001 From: Alexis Gousseau Date: Wed, 11 Jun 2025 15:06:34 +0200 Subject: [PATCH] fix: :bug: load only needed relations of models for schema org render --- app/Models/Product.php | 2 +- app/Models/Recipe.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Models/Product.php b/app/Models/Product.php index c87e12b3..ffa95fe0 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -271,7 +271,7 @@ class Product extends Model implements SeoInterface, Sitemapable, SchemaOrgInter */ public function toSchemaOrg(bool $asReference = false): \Spatie\SchemaOrg\Product { - $model = $this->load(['recipes', 'claims', 'productTypes', 'claims', 'meat', 'submeat', 'range', 'subrange']); + $model = $this->load(['recipes', 'claims', 'productTypes', 'meat', 'submeat', 'range', 'subrange']); // Main. $schema = Schema::Product() diff --git a/app/Models/Recipe.php b/app/Models/Recipe.php index 2f24927e..004050b0 100644 --- a/app/Models/Recipe.php +++ b/app/Models/Recipe.php @@ -280,7 +280,7 @@ class Recipe extends Model implements SeoInterface, Sitemapable, SchemaOrgInterf */ public function toSchemaOrg(bool $asReference = false): \Spatie\SchemaOrg\Recipe { - $model = $this->load(['consumptionMoment']); + $model = $this->load(['products', 'consumptionMoment', 'video']); // Main. $schema = Schema::Recipe()