<?php

use Illuminate\Database\Seeder;
use App\Models\Checkout;
use App\Models\Bidders;
use App\Models\PaymentMethods;

class CheckoutTableSeeder extends Seeder
{
    public function run()
    {
        $bidders = Bidders::all();
        $paymentMethods = PaymentMethods::all();

        foreach ($bidders as $bidder) {
            if (rand(0, 1)) {
                factory(Checkout::class)->create([
                    'bidder_num' => $bidder->idbidders,
                    'payment_method' => $paymentMethods->random()->pm_id,
                ]);
            }
        }
    }
}
