<?php

use Illuminate\Database\Seeder;
use App\Models\WinningBids;
use App\Models\Bidders;
use App\Models\Items;

class WinningBidsTableSeeder extends Seeder
{
    public function run()
    {
        $bidders = Bidders::all();
        $items = Items::all();

        foreach ($items as $item) {
            if (rand(0, 1)) {
                factory(WinningBids::class)->create([
                    'winning_bidder_num' => $bidders->random()->idbidders,
                    'winning_item_num' => $item->iditems,
                ]);
            }
        }
    }
}
