<?php

namespace Database\Seeders;

// use Illuminate\Database\Console\Seeds\WithoutModelEvents;

use App\Models\UserAgenda;
use Faker\Factory;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     *
     * @return void
     */
    public function run()
    {
        // \App\Models\User::factory(10)->create();
        $faker = Factory::create();
        // generate data by calling methods
      
        for($i = 1; $i <= 20; $i++) {
            // random waktu
            $start_date = $faker->dateTimeBetween('+0 days', '+2 day');
            $start_date_clone = clone $start_date;
            $hours = rand(1,6);
            $end_date = $faker->dateTimeBetween($start_date, $start_date_clone->modify('+'.$hours.' hours'));
            // insert data ke table pegawai menggunakan Faker
            UserAgenda::create([
                'idpegawai' => '40a1618d-e46a-4b7f-a730-cfee894c69d2',
                'idagenda' => '6a0304c4-5635-4d0d-8371-d5c89b7d41ff',
                'title' => $faker->sentence,
                'start' => $start_date,
                'end' => $end_date
            ]);
        }

    }
}
