*/ final class OrganisationEmailTemplateFactory extends Factory { protected $model = OrganisationEmailTemplate::class; public function definition(): array { $type = fake()->randomElement(EmailTemplateType::cases()); return [ 'organisation_id' => Organisation::factory(), 'type' => $type->value, 'subject' => fake()->sentence(), 'heading' => fake()->optional()->sentence(4), 'body_text' => fake()->paragraph(), 'button_text' => fake()->optional()->words(3, true), ]; } public function forType(EmailTemplateType $type): static { return $this->state(fn () => ['type' => $type->value]); } }