*/ class LocationFactory extends Factory { protected $model = Location::class; /** * Define the model's default state. * * @return array */ public function definition(): array { return [ 'name' => $this->faker->city(), '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 location is active. */ public function active(): static { return $this->state(fn (array $attributes) => [ 'is_active' => IsActive::ACTIVE->value, ]); } /** * Indicate that the location is inactive. */ public function inactive(): static { return $this->state(fn (array $attributes) => [ 'is_active' => IsActive::INACTIVE->value, ]); } }