Skip to content

Commit

Permalink
fix: potential issue with preventAccessingMissingAttributes
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphjsmit committed Aug 30, 2024
1 parent e2fb635 commit a89219a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Models/SEO.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ public function prepareForUsage(): SEOData
schema: $overrides->schema ?? null,
type: $overrides->type ?? null,
locale: $overrides->locale ?? null,
robots: $overrides->robots ?? $this->robots,
canonical_url: $overrides->canonical_url ?? $this->canonical_url,
// Cannot directly access the `$this->robots` attribute, since that could potentially trigger a `Model::preventAccessingMissingAttributes()` exception.
robots: $overrides->robots ?? $this->getAttributes()['robots'] ?? null,
// Cannot directly access the `$this->canonical_url` attribute, since that could potentially trigger a `Model::preventAccessingMissingAttributes()` exception.
canonical_url: $overrides->canonical_url ?? $this->getAttributes()['canonical_url'] ?? null,
openGraphTitle: $overrides->openGraphTitle ?? null,
alternates: $overrides->alternates ?? null,
);
}
}

0 comments on commit a89219a

Please sign in to comment.