52 lines
1.5 KiB
PHP
52 lines
1.5 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,
|
|
PaymentOptionSeeder::class,
|
|
CategorySeeder::class,
|
|
]);
|
|
|
|
$adminUser = User::firstOrCreate([
|
|
'email' => 'admin@presseportale.test',
|
|
], [
|
|
'name' => 'Portal Admin',
|
|
'password' => Hash::make('password'),
|
|
'portal' => Portal::Both->value,
|
|
'registration_type' => RegistrationType::ExistingLegacy->value,
|
|
'language' => 'de',
|
|
'is_active' => true,
|
|
]);
|
|
|
|
$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,
|
|
]);
|
|
|
|
$rolePermissionSync->assignRoleAndSyncPermissions($testUser, 'customer');
|
|
}
|
|
}
|