presseportale/database/seeders/DatabaseSeeder.php
Kevin Adametz b64aa9fbf5 R0.4: Seeder produktionssicher (PlanSeeder, keine Fake-Stripe-IDs, Dev-User-Guard)
- PlanSeeder (Starter/Business/Pro/Agency) haengt jetzt im DatabaseSeeder
- PaymentOptionSeeder erfindet keine prod_/price_placeholder-IDs mehr
  (Spalten nullable; echte Verknuepfung via Stripe-Sync/Pflege)
- Demo-Zugaenge admin@pressekonto.test/test@example.com (Passwort
  "password") werden nur noch in local/testing angelegt

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 07:58:30 +00:00

61 lines
1.8 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,
// 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');
}
}