Skip to content

Commit

Permalink
change method name
Browse files Browse the repository at this point in the history
  • Loading branch information
nivv committed Jul 2, 2024
1 parent 651a7bd commit f0213de
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Models/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function getRevisionOptions(): RevisionOptions
'image' => 'getImages',
'repeater' => 'getRepeater',
])
->registerCacheTagsToFlush(['cms_pages'])
->registerCacheKeysToFlush(['cms_pages'])
->setIndexable(true, ['page_title'], 'page_title');
}

Expand Down
17 changes: 15 additions & 2 deletions src/Traits/RevisionOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class RevisionOptions
*
* @var array
*/
public $cacheTagsToFlush = [];
public $cacheKeysToFlush = [];

/**
* Default included getters
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Page/PageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit f0213de

Please sign in to comment.