*/ class CustomerFactory extends Factory { protected $model = CustomerModel::class; /** * @return array */ public function definition(): array { return [ 'name' => fake()->unique()->company(), 'type' => CustomerType::Company, 'business_id' => null, ]; } public function company(?string $businessId = null): static { return $this->state(fn (): array => [ 'type' => CustomerType::Company, 'business_id' => $businessId, ]); } public function consumer(): static { return $this->state(fn (): array => [ 'name' => fake()->unique()->name(), 'type' => CustomerType::Consumer, 'business_id' => null, ]); } }