Jede veroeffentlichte Fassung eines Rechtstexts ist eine Zeile mit type/version/effective_from — alte Fassungen sind unloeschbar, zukuenftige werden erst ab Stichtag wirksam (LegalDocument::current). Seeder legt die fuenf aktuellen Fassungen an (AGB 0.6, Datenschutz 0.3, Richtlinien 0.1, Meldeverfahren 0.1, Impressum 0.1). Die Unternehmer-Bestaetigung (T1neu) referenziert jetzt die konkrete Fassung (legal_document_id am Buchungsdatensatz, restrictOnDelete); AGB-Seite und Buchungs-Modal ziehen Version/Stand aus der DB. config/legal.php bleibt reiner Fallback. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
37 lines
858 B
PHP
37 lines
858 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\LegalDocument;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<LegalDocument>
|
|
*/
|
|
class LegalDocumentFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
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]);
|
|
}
|
|
}
|