diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index 56b3646..2a58887 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -213,19 +213,12 @@ class PagesController extends Controller public function receiptpdf(Request $receiptpdf_request) { $checkoutid = $receiptpdf_request->checkout_id; - $checkout_final_results = DB::select("SELECT - * - FROM checkout - WHERE checkout_id = $checkoutid - "); - $bidder_num = $checkout_final_results['0']->bidder_num; - $checkout_list_results = DB::select("SELECT - *, items.item_assigned_num, items.item_desc - FROM winning_bids - INNER JOIN items AS items - ON winning_bids.winning_item_num=items.iditems - WHERE winning_bidder_num = $bidder_num - "); + $checkout_final_results = Checkout::where('checkout_id', '=', $checkoutid) + ->first(); + $bidder_num = $checkout_final_results->bidder_num; + $checkout_list_results = WinningBids::with('items') + ->where('winning_bidder_num', '=', '$bidder_num') + ->get(); $checkout_info_results = DB::select("SELECT winning_bids.*, bidders.*, diff --git a/resources/views/receiptpdf.blade.php b/resources/views/receiptpdf.blade.php index 2238f4d..109b259 100644 --- a/resources/views/receiptpdf.blade.php +++ b/resources/views/receiptpdf.blade.php @@ -84,13 +84,13 @@ @foreach($checkout_list_results as $checkout_list_result) - {{ $checkout_list_result->item_assigned_num }} + {{ $checkout_list_result->items->item_assigned_num }} - {{ $checkout_list_result->item_desc }} + {{ $checkout_list_result->items->item_desc }} - ${{ $checkout_list_result->winning_cost }} + ${{ $checkout_list_result->items->winning_cost }} @endforeach @@ -181,13 +181,13 @@ @foreach($checkout_list_results as $checkout_list_result) - {{ $checkout_list_result->item_assigned_num }} + {{ $checkout_list_result->items->item_assigned_num }} - {{ $checkout_list_result->item_desc }} + {{ $checkout_list_result->items->item_desc }} - ${{ $checkout_list_result->winning_cost }} + ${{ $checkout_list_result->items->winning_cost }}