*/ class LegalDocumentFactory extends Factory { /** * Define the model's default state. * * @return array */ public function definition(): array { return [ 'type' => LegalDocument::TYPE_AGB, 'version' => '0.'.fake()->unique()->numberBetween(1, 999), 'effective_from' => today()->subDays(fake()->numberBetween(1, 365)), 'note' => null, ]; } public function agb(): static { return $this->state(['type' => LegalDocument::TYPE_AGB]); } public function effectiveFrom(string $date): static { return $this->state(['effective_from' => $date]); } }