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>
62 lines
1.9 KiB
PHP
62 lines
1.9 KiB
PHP
<?php
|
||
|
||
namespace Database\Seeders;
|
||
|
||
use App\Enums\Portal;
|
||
use App\Enums\RegistrationType;
|
||
use App\Models\User;
|
||
use App\Services\Auth\UserRolePermissionSyncService;
|
||
use Illuminate\Database\Seeder;
|
||
use Illuminate\Support\Facades\Hash;
|
||
|
||
class DatabaseSeeder extends Seeder
|
||
{
|
||
/**
|
||
* Seed the application's database.
|
||
*/
|
||
public function run(UserRolePermissionSyncService $rolePermissionSync): void
|
||
{
|
||
$this->call([
|
||
RolesAndPermissionsSeeder::class,
|
||
AdminPresetSeeder::class,
|
||
PlanSeeder::class,
|
||
PaymentOptionSeeder::class,
|
||
LegalDocumentSeeder::class,
|
||
// CategorySeeder::class,
|
||
]);
|
||
|
||
// Demo-Zugänge (Passwort "password") nur in lokalen Umgebungen –
|
||
// niemals in Produktion anlegen.
|
||
if (! app()->environment(['local', 'testing'])) {
|
||
return;
|
||
}
|
||
|
||
$adminUser = User::firstOrCreate([
|
||
'email' => 'admin@pressekonto.test',
|
||
], [
|
||
'name' => 'Portal Admin',
|
||
'password' => Hash::make('password'),
|
||
'portal' => Portal::Both->value,
|
||
'registration_type' => RegistrationType::ExistingLegacy->value,
|
||
'language' => 'de',
|
||
'is_active' => true,
|
||
'email_verified_at' => now(),
|
||
]);
|
||
|
||
$rolePermissionSync->assignRoleAndSyncPermissions($adminUser, 'admin');
|
||
|
||
$testUser = User::firstOrCreate([
|
||
'email' => 'test@example.com',
|
||
], [
|
||
'name' => 'Test User',
|
||
'password' => Hash::make('password'),
|
||
'portal' => Portal::Both->value,
|
||
'registration_type' => RegistrationType::ExistingLegacy->value,
|
||
'language' => 'de',
|
||
'is_active' => true,
|
||
'email_verified_at' => now(),
|
||
]);
|
||
|
||
$rolePermissionSync->assignRoleAndSyncPermissions($testUser, 'customer');
|
||
}
|
||
}
|