*/ class WorldWebStoryFactory extends Factory { protected $model = WorldWebStory::class; public function definition(): array { $title = Str::title($this->faker->unique()->words(3, true)); $slug = Str::slug($title); return [ 'world_id' => World::factory(), 'slug' => $slug, 'title' => $title, 'subtitle' => $this->faker->sentence(6), 'excerpt' => $this->faker->sentence(14), 'description' => $this->faker->paragraph(), 'seo_title' => $title . ' – Skinbase Web Story', 'seo_description' => $this->faker->sentence(18), 'poster_portrait_path' => 'web-stories/worlds/' . $slug . '/poster-portrait.webp', 'poster_square_path' => 'web-stories/worlds/' . $slug . '/poster-square.webp', 'publisher_logo_path' => 'images/skinbase_logo_96.webp', 'status' => WorldWebStory::STATUS_DRAFT, 'featured' => false, 'active' => true, 'noindex' => false, 'published_at' => null, 'starts_at' => null, 'ends_at' => null, 'created_by' => User::factory(), 'updated_by' => User::factory(), ]; } public function published(): self { return $this->state(fn (): array => [ 'status' => WorldWebStory::STATUS_PUBLISHED, 'published_at' => Carbon::now()->subHour(), ]); } public function visible(): self { return $this->published()->state(fn (): array => [ 'active' => true, 'noindex' => false, 'starts_at' => Carbon::now()->subDay(), 'ends_at' => Carbon::now()->addDay(), ]); } }