<?php

namespace Database\Seeders;

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

class AdminSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        //updateOrCreate
        $user1 = User::updateOrCreate(
            // Unique identifier
            ['email' => 'admin@cripumps.com'],

            // Data to update/create
            [
                'name' => 'Admin',
                'password' => Hash::make('jOtHi$9000'),
                'updated_at' => now(),
                'created_at' => now()
            ]
        );
        // $user1 = User::firstOrCreate([
        //     'name' => 'Admin',
        //     'email' => 'admin@cripumps.com',
        //     'password' => bcrypt('admin'),
        // ]);
        $user1->assignRole('Super Admin');
    }
}
