Convert some helpers to using models

This commit is contained in:
Russ Long 2018-12-23 09:02:54 -05:00
parent 56c9a45c33
commit 72af40a364

View File

@ -3,16 +3,20 @@ namespace App;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use App\Models\Bidders;
use App\Models\Items;
class BidderSelectList class BidderSelectList
{ {
public static function BidderShowNumbers() public static function BidderShowNumbers()
{ {
$bidder_num_results = DB::select("SELECT //$bidder_num_results = DB::select("SELECT
* //*
FROM bidders //FROM bidders
ORDER BY bidder_assigned_number //ORDER BY bidder_assigned_number
"); //");
$bidder_num_results = Bidders::orderBy('bidder_assigned_number')
->get();
$bidder_num = '<option disabled selected hidden value="">choose...</option>'; $bidder_num = '<option disabled selected hidden value="">choose...</option>';
foreach($bidder_num_results as $bidder_num_result){ foreach($bidder_num_results as $bidder_num_result){
$bidder_num .= '<option value="' . $bidder_num_result->idbidders . '">' . $bidder_num_result->bidder_assigned_number . ' - ' . $bidder_num_result->bidder_fname . ' ' . $bidder_num_result->bidder_lname .'</option>'; $bidder_num .= '<option value="' . $bidder_num_result->idbidders . '">' . $bidder_num_result->bidder_assigned_number . ' - ' . $bidder_num_result->bidder_fname . ' ' . $bidder_num_result->bidder_lname .'</option>';