*/ class SubClassificationFactory extends Factory { protected $model = SubClassification::class; /** * Define the model's default state. * * @return array */ public function definition(): array { return [ 'classification_id' => Classification::factory(), 'name' => $this->faker->words(2, true), 'description' => $this->faker->sentence(), 'is_active' => $this->faker->randomElement([IsActive::ACTIVE->value, IsActive::INACTIVE->value]), 'sort_order' => $this->faker->numberBetween(0, 100), ]; } /** * Indicate that the sub classification is active. */ public function active(): static { return $this->state(fn (array $attributes) => [ 'is_active' => IsActive::ACTIVE->value, ]); } /** * Indicate that the sub classification is inactive. */ public function inactive(): static { return $this->state(fn (array $attributes) => [ 'is_active' => IsActive::INACTIVE->value, ]); } }