*/ class PressReleaseFactory extends Factory { protected $model = PressRelease::class; public function definition(): array { $title = fake()->sentence(6); return [ 'uuid' => (string) Str::uuid(), 'portal' => fake()->randomElement([Portal::Presseecho->value, Portal::Businessportal24->value]), 'user_id' => User::factory(), 'company_id' => Company::factory(), 'category_id' => Category::factory(), 'language' => 'de', 'title' => $title, 'slug' => Str::slug($title).'-'.fake()->unique()->numberBetween(1000, 9999), 'text' => fake()->paragraphs(3, true), 'status' => PressReleaseStatus::Draft->value, 'hits' => 0, 'no_export' => false, ]; } public function published(): static { return $this->state([ 'status' => PressReleaseStatus::Published->value, 'published_at' => now(), ]); } public function inReview(): static { return $this->state(['status' => PressReleaseStatus::Review->value]); } public function forPortal(Portal $portal): static { return $this->state(['portal' => $portal->value]); } }