<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
use App\Models\User;

class AdminUserSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        // Cek jika user sudah ada
        if (!User::where('email', 'admin@sebaranrtlh.com')->exists()) {
            User::create([
                'name' => 'Administrator',
                'email' => 'admin@sebaranrtlh.com',
                'password' => Hash::make('password_rahasia'), // Ganti nanti
            ]);
            $this->command->info('User Admin berhasil dibuat: admin@sebaranrtlh.com / password_rahasia');
        } else {
            $this->command->info('User Admin sudah ada.');
        }
    }
}
