<?php

namespace Database\Seeders;

use App\Models\PtwMstWorkerDsg;
use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class PtwMstWorkerDsgSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
         //lets truncate the existing records
       PtwMstWorkerDsg::truncate();

       $vvsFaker = \Faker\Factory::create();
       $userIds = User::pluck('ID')->all();

       for ($i = 0; $i < 10; $i++) {
        PtwMstWorkerDsg::create([
               "WORKER_DESG_NAME" => $vvsFaker->word,
               "CREATED_BY" => $userIds[array_rand($userIds)],
           ]);
       }
    }
}
