Skip to content

Commit

Permalink
Refactor HasSearchableName trait to deprecate old methods and add new…
Browse files Browse the repository at this point in the history
… ones
  • Loading branch information
ewilan-riviere committed Jun 12, 2024
1 parent 54241ea commit f713044
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Traits/HasSearchableName.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,30 @@ public static function searchAsSearchable(string $search, bool $asObject = true)
return $results;
}

/**
* @deprecated use `saveNoSearch` instead
*/
public function saveWithoutSyncingToSearch(): void
{
$this->saveNoSearch();
}

/**
* @deprecated use `updateNoSearch` instead
*/
public function updateWithoutSyncingToSearch(array $attributes = [], array $options = []): bool
{
return $this->updateNoSearch($attributes, $options);
}

public function saveNoSearch(): void
{
$this::withoutSyncingToSearch(function () {
$this->saveQuietly();
});
}

public function updateWithoutSyncingToSearch(array $attributes = [], array $options = []): bool
public function updateNoSearch(array $attributes = [], array $options = []): bool
{
return $this::withoutSyncingToSearch(function () use ($attributes, $options) {
return $this->update($attributes, $options);
Expand Down

0 comments on commit f713044

Please sign in to comment.