*/ class AnnouncementFactory extends Factory { /** * @return array */ public function definition(): array { $title = fake()->unique()->sentence(4); return [ 'slug' => Str::slug($title), 'title' => $title, 'category' => fake()->randomElement(AnnouncementCategory::cases()), 'excerpt' => fake()->paragraph(), 'content' => fake()->paragraphs(5, true), 'image' => null, 'is_featured' => fake()->boolean(20), 'meta_title' => fake()->sentence(4), 'meta_description' => fake()->sentence(10), 'published_at' => fake()->dateTimeBetween('-6 months', 'now'), ]; } public function featured(): static { return $this->state(fn (array $attributes) => [ 'is_featured' => true, ]); } }