*/ class CategoryFactory extends Factory { protected $model = Category::class; public function definition(): array { return [ 'portal' => fake()->randomElement([Portal::Presseecho->value, Portal::Businessportal24->value, Portal::Both->value]), 'is_active' => true, ]; } public function withTranslations(): static { return $this->afterCreating(function (Category $category): void { $category->translations()->createMany([ ['locale' => 'de', 'name' => fake('de_DE')->words(2, true), 'slug' => 'de-'.fake()->unique()->slug(2)], ['locale' => 'en', 'name' => fake('en_US')->words(2, true), 'slug' => 'en-'.fake()->unique()->slug(2)], ]); }); } }