Skip to content

Commit

Permalink
add options for indexable keys
Browse files Browse the repository at this point in the history
  • Loading branch information
nivv committed Jun 17, 2024
1 parent fe8bb64 commit 749f75e
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/Traits/RevisionOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,27 @@ class RevisionOptions
*/
public $defaultGetters = ['repeater' => 'getRepeater'];

/**
* If the model should be indexable
*
* @var bool
*/
public $isIndexable = false;

/**
* Indexable keys
*
* @var array
*/
public $indexableKeys = [];

public static function create(): self
{
return new static();
}

/**
* Register affected types
*
* @param array $types
* @return self
*/
public function registerSpecialTypes(array $types): self
{
Expand All @@ -64,9 +75,6 @@ public function registerSpecialTypes(array $types): self

/**
* Register new getters
*
* @param array $getters
* @return self
*/
public function registerGetters(array $getters): self
{
Expand All @@ -77,9 +85,6 @@ public function registerGetters(array $getters): self

/**
* Register a default template
*
* @param string $slug
* @return self
*/
public function registerDefaultTemplate(string $slug): self
{
Expand All @@ -94,4 +99,12 @@ public function registerCacheTagsToFlush(array $tags): self

return $this;
}

public function setSearchable(bool $searchable, array $indexableKeys = []): self
{
$this->isIndexable = $searchable;
$this->indexableKeys = $indexableKeys;

return $this;
}
}

0 comments on commit 749f75e

Please sign in to comment.