<?php

namespace Database\Seeders;

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

class UserSeeder extends Seeder
{
    public function run()
    {
        // Cek apakah email sudah ada di database
        if (!User::where('email', 'penjual@example.com')->exists()) {
            $user = new User;
            $user->name = 'Penjual';
            $user->email = 'penjual@example.com';
            $user->password = Hash::make('password'); // Pastikan password di-hash
            $user->save();
        } else {
            echo "User dengan email 'penjual@example.com' sudah ada.\n";
        }
    }
}
