From 055934376e72a61a1d18f6fcaeecd4a9ff2b8317 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Mon, 24 Dec 2018 13:29:48 -0500 Subject: [PATCH] convert winnerlist --- app/Http/Controllers/PagesController.php | 13 ++++--------- resources/views/winnerlist.blade.php | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index 425628a..08f7287 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -261,15 +261,10 @@ class PagesController extends Controller public function winnerlist() { - $winnerlist_results = DB::select("SELECT - *, bidders.bidder_assigned_number, items.item_assigned_num - FROM winning_bids - INNER JOIN bidders as bidders - ON winning_bids.winning_bidder_num=bidders.idbidders - INNER JOIN items as items - ON winning_bids.winning_item_num=items.iditems - ORDER BY winning_item_num ASC - "); + $winnerlist_results = WinningBids::join('bidders', 'winning_bids.winning_bidder_num', '=', 'bidders.idbidders') + ->groupBy('winning_bidder_num') + ->orderBy('bidders.bidder_assigned_number') + ->get(); return view('winnerlist', ['winnerlist_results' => $winnerlist_results]); } diff --git a/resources/views/winnerlist.blade.php b/resources/views/winnerlist.blade.php index 7955e84..50057d2 100644 --- a/resources/views/winnerlist.blade.php +++ b/resources/views/winnerlist.blade.php @@ -15,7 +15,7 @@ foreach($winnerlist_results as $winnerlist_result){ - echo "" . $winnerlist_result->winning_bidder_num . ""; + echo "" . $winnerlist_result->bidders->bidder_assigned_number . ""; // do we need a new row? if($i % 6 === 0){