67 lines
1.7 KiB
PHP
67 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Database\Seeder;
|
|
use Illuminate\Support\Facades\Hash;
|
|
|
|
class UserSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*/
|
|
public function run(): void
|
|
{
|
|
// Developer
|
|
$developer = User::updateOrCreate(
|
|
['username' => 'pangestu'],
|
|
[
|
|
'email' => 'info.pangestuyoga@gmail.com',
|
|
'password' => Hash::make('Minimal8@'),
|
|
]
|
|
);
|
|
|
|
$developer->profile()->updateOrCreate(
|
|
['nik' => '3213051307900001'],
|
|
[
|
|
'full_name' => 'Yoga Pangestu',
|
|
'phone_number' => '082121495806',
|
|
'address' => 'Jl. Contoh No. 123',
|
|
'birth_place' => 'Jakarta',
|
|
'birth_date' => '1990-01-01',
|
|
'base_salary' => 0,
|
|
]
|
|
);
|
|
|
|
$developer->assignRole('Developer');
|
|
|
|
// Owner
|
|
$owner = User::updateOrCreate(
|
|
['username' => 'owner'],
|
|
[
|
|
'email' => 'owner@gmail.com',
|
|
'password' => Hash::make('Minimal8@'),
|
|
]
|
|
);
|
|
|
|
$owner->profile()->updateOrCreate(
|
|
['nik' => '3213051307900002'],
|
|
[
|
|
'full_name' => 'Owner',
|
|
'phone_number' => '082121212121',
|
|
'address' => 'Jl. Contoh No. 123',
|
|
'birth_place' => 'Jakarta',
|
|
'birth_date' => '1990-01-01',
|
|
'base_salary' => 0,
|
|
]
|
|
);
|
|
|
|
$owner->assignRole('Owner');
|
|
|
|
User::factory(10)->create()->each(function ($u) {
|
|
$u->assignRole('Admin');
|
|
});
|
|
}
|
|
}
|