*/ class ServiceFactory extends Factory { protected $model = Service::class; /** * @return array */ public function definition(): array { $title = fake()->unique()->words(3, true); return [ 'title' => $title, 'slug' => str($title)->slug()->toString(), 'summary' => fake()->sentence(), 'description' => fake()->paragraphs(2, true), 'cover_image_path' => null, 'cover_image_alt' => null, 'sort_order' => 0, 'is_featured' => false, 'published_at' => null, ]; } public function published(): static { return $this->state(fn (array $attributes): array => [ 'published_at' => now(), ]); } public function featured(): static { return $this->state(fn (array $attributes): array => [ 'is_featured' => true, ]); } }