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 "