From 58cafe625509eb89cec2dae5df251248afe9dbee Mon Sep 17 00:00:00 2001 From: Michael Aerni Date: Fri, 30 Aug 2024 11:14:17 -0400 Subject: [PATCH] Add published state method --- src/Factories/Factory.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Factories/Factory.php b/src/Factories/Factory.php index 8658074..8777384 100644 --- a/src/Factories/Factory.php +++ b/src/Factories/Factory.php @@ -243,6 +243,15 @@ public function site(string $site): self }; } + public function published(bool|string $published): self + { + return match ($published) { + 'random' => $this->sequence(fn (Sequence $sequence) => ['published' => collect([true, false])->random()]), + false, 'false' => $this->set('published', false), + default => $this->set('published', true), + }; + } + protected function getSitesFromContentModel(): Collection { $contentModel = $this->newContentModel();