Convert more helpers

This commit is contained in:
Russ Long 2018-12-23 09:09:06 -05:00
parent 72af40a364
commit f14e20b22a

View File

@ -5,16 +5,12 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use App\Models\Bidders; use App\Models\Bidders;
use App\Models\Items; use App\Models\Items;
use App\Models\Checkout;
class BidderSelectList class BidderSelectList
{ {
public static function BidderShowNumbers() public static function BidderShowNumbers()
{ {
//$bidder_num_results = DB::select("SELECT
//*
//FROM bidders
//ORDER BY bidder_assigned_number
//");
$bidder_num_results = Bidders::orderBy('bidder_assigned_number') $bidder_num_results = Bidders::orderBy('bidder_assigned_number')
->get(); ->get();
$bidder_num = '<option disabled selected hidden value="">choose...</option>'; $bidder_num = '<option disabled selected hidden value="">choose...</option>';
@ -29,14 +25,9 @@ class CheckoutBidderSelectList
{ {
public static function CheckoutBidderShowNumbers() public static function CheckoutBidderShowNumbers()
{ {
$checkout_bidder_num_results = DB::select("SELECT $checkout_bidder_num_results = Checkout::with('bidders')
bidder_num, bidders.* ->orderBy('bidder_assigned_number')
FROM checkout ->get();
INNER JOIN bidders AS bidders
ON checkout.bidder_num=bidders.idbidders
GROUP BY bidders.bidder_assigned_number
ORDER BY bidders.bidder_assigned_number
");
$checkout_bidder_num = '<option disabled selected hidden value="">choose...</option>'; $checkout_bidder_num = '<option disabled selected hidden value="">choose...</option>';
foreach($checkout_bidder_num_results as $checkout_bidder_num_result){ foreach($checkout_bidder_num_results as $checkout_bidder_num_result){
$checkout_bidder_num .= '<option value="' . $checkout_bidder_num_result->idbidders . '">' . $checkout_bidder_num_result->bidder_assigned_number . ' - ' . $checkout_bidder_num_result->bidder_fname . ' ' . $checkout_bidder_num_result->bidder_lname .'</option>'; $checkout_bidder_num .= '<option value="' . $checkout_bidder_num_result->idbidders . '">' . $checkout_bidder_num_result->bidder_assigned_number . ' - ' . $checkout_bidder_num_result->bidder_fname . ' ' . $checkout_bidder_num_result->bidder_lname .'</option>';