add new users on seeder for role user and superadmin

This commit is contained in:
arifal
2025-03-27 17:19:27 +07:00
parent 7b70591be5
commit 6294d2f950
3 changed files with 41 additions and 17 deletions

View File

@@ -15,18 +15,35 @@ class DatabaseSeeder extends Seeder
*/
public function run(): void
{
User::updateOrCreate(
['email' => 'user@demo.com'], // Kondisi pencarian
$users = [
[
'name' => 'Darkone',
'email' => 'user@sibedas.com',
'name' => 'User',
'email_verified_at' => now(),
'password' => Hash::make('password'),
'firstname' => 'John',
'lastname' => 'Doe',
'position' => 'crusial',
'firstname' => 'user',
'lastname' => 'user',
'position' => 'user',
'remember_token' => Str::random(10),
]
);
],
[
'email' => 'superadmin@sibedas.com',
'name' => 'Superadmin',
'email_verified_at' => now(),
'password' => Hash::make('password'),
'firstname' => 'superadmin',
'lastname' => 'superadmin',
'position' => 'superadmin',
'remember_token' => Str::random(10),
],
];
foreach ($users as $user) {
User::updateOrCreate(
['email' => $user['email']], // Search condition
$user // Update or create with this data
);
}
$this->call([
RoleSeeder::class,