<?php
namespace App\Helpers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Models\Bidders;
use App\Models\Items;
use App\Models\Checkout;
use App\Models\PaymentMethods;
use App\Models\WinningBids;

class WinningBidderSelectList
{
    public static function winningBidderShowNumbers()
    {

        $winning_bidder_num_results = WinningBids::join(
            'bidders',
            'winning_bids.winning_bidder_num',
            '=',
            'bidders.idbidders'
        )
                                                ->groupBy('winning_bidder_num')
                                                ->orderBy('bidders.bidder_assigned_number')
                                                ->get();

        $winning_bidder_num = '<option disabled selected hidden value="">choose...</option>';
        foreach ($winning_bidder_num_results as $winning_bidder_num_result) {
            $winning_bidder_num .= '<option value="' .
            $winning_bidder_num_result->idbidders .
            '">' .
            $winning_bidder_num_result->bidder_assigned_number .
            ' - ' .
            $winning_bidder_num_result->bidder_fname .
            ' ' .
            $winning_bidder_num_result->bidder_lname .
            '</option>';
        }
        return $winning_bidder_num;
    }
}
