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