*/ class LanguageFactory extends Factory { protected $model = Language::class; public function definition(): array { return [ // Not a real language code: tests hardcode 'en', 'fr', 'nl' and // others, and faker's pool would collide with them. 'short_code' => 'x-'.$this->faker->unique()->numerify('####'), 'name' => $this->faker->unique()->word(), 'native_name' => $this->faker->optional()->word(), 'is_active' => true, ]; } public function inactive(): static { return $this->state(fn (array $attributes) => [ 'is_active' => false, ]); } public function english(): static { return $this->state(fn (array $attributes) => [ 'short_code' => 'en', 'name' => 'English', 'native_name' => 'English', ]); } }