Refactor database seeder to use config for admin credentials and add admin configuration file

This commit is contained in:
Roberto Guagliardo
2025-07-09 02:04:04 +02:00
parent b2f5618ca1
commit 01f27c6945
2 changed files with 12 additions and 4 deletions

7
config/admin.php Normal file
View File

@@ -0,0 +1,7 @@
<?php
return [
'name' => env('ADMIN_NAME', 'Admin'),
'email' => env('ADMIN_EMAIL', 'admin@example.com'),
'password' => env('ADMIN_PASSWORD', 'changeme123'),
];

View File

@@ -16,14 +16,15 @@ class DatabaseSeeder extends Seeder
// User::factory(10)->create(); // User::factory(10)->create();
User::updateOrCreate( User::updateOrCreate(
['email' => env('ADMIN_EMAIL')], ['email' => config('admin.email')],
[ [
'name' => env('ADMIN_NAME'), 'name' => config('admin.name'),
'email' => env('ADMIN_EMAIL'), 'email' => config('admin.email'),
'password' => Hash::make(env('ADMIN_PASSWORD')), 'password' => Hash::make(config('admin.password')),
] ]
); );
// Andere seeders uitvoeren // Andere seeders uitvoeren
$this->call([ $this->call([
EducationSeeder::class, EducationSeeder::class,