<?php

namespace Database\Seeders;

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

class UserSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $user=User::create([
            'name' => 'Diego Alexander',
            'last_name' => 'Rojas Rios',
            'email' => 'diegorojasrios31@gmail.com',
            'password' => Hash::make('123456789'),
            'phone' => '75669643',
            'cod_phone' => '591',
            'branch_id' => 1,
        ]);
        $user->roles()->syncWithoutDetaching(Role::where('name', 'ASESOR')->firstOrFail()->id);

        $userAdmin=User::create([
            'name' => 'Melanie',
            'last_name' => 'Yupanqui',
            'email' => 'melanieyupanqui44@gmail.com',
            'password' => Hash::make('123456789'),
            'phone' => '76042970',
            'cod_phone' => '591',
            'branch_id' => 1,
        ]);
        $userAdmin->roles()->syncWithoutDetaching(Role::where('name', 'ADMINISTRADOR')->firstOrFail()->id);

        $user=User::create([
            'name' => 'Belen',
            'last_name' => 'Fernandez',
            'email' => 'belen@canzza.com.bo',
            'password' => Hash::make('verticalhomes'),
            'phone' => '71895075',
            'cod_phone' => '591',
            'branch_id' => 1,
        ]);
        $user->roles()->syncWithoutDetaching(Role::where('name', 'ASESOR')->firstOrFail()->id);
    }

}
