<?php

namespace Database\Seeders;

// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Hash;
use App\Models\Master\Group;
use App\Models\User;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     */
    public function run(): void
    {
        // \App\Models\User::factory(10)->create();

        // \App\Models\User::factory()->create([
        //     'name' => 'Test User',
        //     'email' => 'test@example.com',
        // ]);

        $group = [
            ['name' => 'Administrator','alias' => 'administrator'],
            ['name' => 'Dinas','alias' => 'dinas'],
        ];

        foreach($group as $valGroup){
            Group::updateOrCreate([
                'name' => $valGroup['name'],
                'alias' => $valGroup['alias'],
            ],[
                'name' => $valGroup['name'],
                'alias' => $valGroup['alias'],
                'status' => 1,
            ]);
        }

        User::updateOrCreate([
            'name'          => 'Administrator',
            'username'      => 'administrator',
            'email'         => 'adminadiwiyata@dlh.go.id',
        ],[
            'name'          => 'Administrator',
            'username'      => 'administrator',
            'email'         => 'admindikplhd@dlh.go.id',
            'ms_group_id'   => '1',
            'password'      => Hash::make('##Dikplhd2025'),
        ]);
    }
}
