<?php

namespace Database\Seeders;

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

class UserSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        foreach (Customer::all() as $customer) {
            User::factory([
                'username'    => str_replace(',', '', strtolower(explode(' ', $customer->company_name)[0])),
                'password'    => 'password',
                'customer_id' => $customer->id,
            ])->create();
        }
    }
}
