From f0213deec2e953f50b0302d1a1897f62b9d3d25a Mon Sep 17 00:00:00 2001 From: Albin N Date: Tue, 2 Jul 2024 10:01:43 +0200 Subject: [PATCH] change method name --- src/Models/Page.php | 2 +- src/Traits/RevisionOptions.php | 17 +++++++++++++++-- tests/Page/PageTest.php | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/Models/Page.php b/src/Models/Page.php index 2487224..f553721 100644 --- a/src/Models/Page.php +++ b/src/Models/Page.php @@ -25,7 +25,7 @@ public function getRevisionOptions(): RevisionOptions 'image' => 'getImages', 'repeater' => 'getRepeater', ]) - ->registerCacheTagsToFlush(['cms_pages']) + ->registerCacheKeysToFlush(['cms_pages']) ->setIndexable(true, ['page_title'], 'page_title'); } diff --git a/src/Traits/RevisionOptions.php b/src/Traits/RevisionOptions.php index 4f7b95c..9d4fa99 100644 --- a/src/Traits/RevisionOptions.php +++ b/src/Traits/RevisionOptions.php @@ -35,7 +35,7 @@ class RevisionOptions * * @var array */ - public $cacheTagsToFlush = []; + public $cacheKeysToFlush = []; /** * Default included getters @@ -107,9 +107,22 @@ public function registerDefaultTemplate(string $slug): self return $this; } + public function registerCacheKeysToFlush(array $tags): self + { + $this->cacheKeysToFlush = $tags; + + return $this; + } + + /** + * @deprecated + * + * @param array $tags + * @return self + */ public function registerCacheTagsToFlush(array $tags): self { - $this->cacheTagsToFlush = $tags; + $this->cacheKeysToFlush = $tags; return $this; } diff --git a/tests/Page/PageTest.php b/tests/Page/PageTest.php index 1475b42..ef992e9 100644 --- a/tests/Page/PageTest.php +++ b/tests/Page/PageTest.php @@ -407,7 +407,7 @@ public function it_can_get_revision_options() $page = Page::factory()->create([ 'revision' => 10, ]); - $tagsToFlush = $page->getRevisionOptions()->cacheTagsToFlush; + $tagsToFlush = $page->getRevisionOptions()->cacheKeysToFlush; // Act