*/ class ProviderFactory extends Factory { /** * Define the model's default state. * * @return array */ public function definition(): array { return [ 'name' => 'keystone', 'type' => $this->faker->randomElement([ ProviderType::HETZNER, ]), 'token' => env('HETZNER_KEY') ?? $this->faker->uuid(), ]; } public function forOrganisation(string|Organisation $organisation): static { return $this->state(fn (array $attributes) => [ 'organisation_id' => is_string($organisation) ? $organisation : $organisation->id, ]); } }