Skip to content

Commit

Permalink
draftContext, publishedContext, versionContext methods added to Revisor
Browse files Browse the repository at this point in the history
  • Loading branch information
sheadawson committed Oct 22, 2024
1 parent 180b711 commit 0d67f0d
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/Revisor.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,36 @@ public function setContext(RevisorContext $context): static
return $this;
}

/**
* Set the current RevisorContext to Draft
*/
public function draftContext(): static
{
$this->setContext(RevisorContext::Draft);

return $this;
}

/**
* Set the current RevisorContext to Published
*/
public function publishedContext(): static
{
$this->setContext(RevisorContext::Published);

return $this;
}

/**
* Set the current RevisorContext to Version
*/
public function versionContext(): static
{
$this->setContext(RevisorContext::Version);

return $this;
}

/**
* Execute the given callback with the given RevisorContext
* Useful for switching context temporarily
Expand Down

0 comments on commit 0d67f0d

Please sign in to comment.