<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class BukuTamuSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        // Ambil sembarang user ID
        $userId = DB::table('users')->value('id');

        if ($userId) {
            DB::table('buku_tamu')->insert([
                [
                    'id_user' => $userId,
                    'tujuan_kunjungan' => 'Membaca Buku',
                    'tanggal_kunjungan' => now(),
                ],
                [
                    'id_user' => $userId,
                    'tujuan_kunjungan' => 'Meminjam Buku',
                    'tanggal_kunjungan' => now()->subDay(),
                ],
            ]);
        }
    }
}
