From 57f392ef3f5922686fb8669ab3f1f79452ee10ed Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sat, 29 Dec 2018 14:09:40 -0500 Subject: [PATCH] convert recieptpdf --- app/Http/Controllers/PagesController.php | 13 ++++++++++--- app/Models/WinningBids.php | 2 +- resources/views/receiptpdf.blade.php | 20 +++++++++++--------- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index f018de8..3d64f93 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -216,9 +216,16 @@ class PagesController extends Controller $checkout_final_results = Checkout::where('checkout_id', '=', $checkoutid) ->first(); $bidder_num = $checkout_final_results->bidder_num; - $checkout_list_results = WinningBids::with('items_rel') - ->where('winning_bidder_num', '=', $bidder_num) - ->get(); + $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 + "); + WinningBids::with('items') + ->where('winning_bidder_num', '=', '$bidder_num') + ->get(); $checkout_info_results = DB::select("SELECT winning_bids.*, bidders.*, diff --git a/app/Models/WinningBids.php b/app/Models/WinningBids.php index 0abc95c..6cf890a 100644 --- a/app/Models/WinningBids.php +++ b/app/Models/WinningBids.php @@ -20,7 +20,7 @@ class WinningBids extends Model 'updated_at' ]; - public function items_rel() + public function items() { return $this->hasMany('App\Models\Items', 'iditems', 'winning_item_num'); } diff --git a/resources/views/receiptpdf.blade.php b/resources/views/receiptpdf.blade.php index 9529157..2238f4d 100644 --- a/resources/views/receiptpdf.blade.php +++ b/resources/views/receiptpdf.blade.php @@ -84,10 +84,10 @@ @foreach($checkout_list_results as $checkout_list_result) - {{ $checkout_list_result->items_rel->first()->item_assigned_num }} + {{ $checkout_list_result->item_assigned_num }} - {{ $checkout_list_result->items_rel->first()->item_desc }} + {{ $checkout_list_result->item_desc }} ${{ $checkout_list_result->winning_cost }} @@ -108,19 +108,21 @@ - @if($checkout_final_results->payment_method==1) + @foreach($checkout_final_results as $checkout_final_result) + @if($checkout_final_result->payment_method==1)

CASH

- @elseif($checkout_final_results->payment_method==2) + @elseif($checkout_final_result->payment_method==2)

- CHECK Number {{ $checkout_final_results->check_number }} + CHECK Number {{ $checkout_final_result->check_number }}

@else

- CREDIT {{ $checkout_final_results->cc_transaction }} + CREDIT {{ $checkout_final_result->cc_transaction }}

@endif + @endforeach @@ -179,13 +181,13 @@ @foreach($checkout_list_results as $checkout_list_result) - {{ $checkout_list_result->items_rel->first()->item_assigned_num }} + {{ $checkout_list_result->item_assigned_num }} - {{ $checkout_list_result->items_rel->first()->item_desc }} + {{ $checkout_list_result->item_desc }} - ${{ $checkout_list_result->items->winning_cost }} + ${{ $checkout_list_result->winning_cost }}