presseportale/database/seeders/DatabaseSeeder.php
Kevin Adametz 196f83a377 E3: Rechtstext-Versionierung in der DB (legal_documents)
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>
2026-07-06 09:21:52 +00:00

62 lines
1.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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');
}
}