Skip to content

Commit

Permalink
Save resources
Browse files Browse the repository at this point in the history
  • Loading branch information
aerni committed Sep 9, 2024
1 parent 00ae9c2 commit 24bbd0a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Factories/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,14 @@ public function unpublished(): self

protected function getSitesFromContentModel(): Collection
{
$contentModel = $this->newContentModel();
return once(function () {
$contentModel = $this->newContentModel();

return match (true) {
$contentModel instanceof Entry => $contentModel->sites(),
$contentModel instanceof Term => $contentModel->taxonomy()->sites(),
};
return match (true) {
$contentModel instanceof Entry => $contentModel->sites(),
$contentModel instanceof Term => $contentModel->taxonomy()->sites(),
};
});
}

protected function getDefaultSiteFromContentModel(): string
Expand Down

0 comments on commit 24bbd0a

Please sign in to comment.