From 56c9a45c33a45d951be04bf275ea328ff39259df Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:00:22 -0500 Subject: [PATCH 01/66] create models --- app/Models/Bidders.php | 31 +++++++++++++++++++++++++++++++ app/Models/Checkout.php | 28 ++++++++++++++++++++++++++++ app/Models/Items.php | 21 +++++++++++++++++++++ app/Models/PaymentMethods.php | 19 +++++++++++++++++++ app/Models/WinningBids.php | 25 +++++++++++++++++++++++++ 5 files changed, 124 insertions(+) create mode 100644 app/Models/Bidders.php create mode 100644 app/Models/Checkout.php create mode 100644 app/Models/Items.php create mode 100644 app/Models/PaymentMethods.php create mode 100644 app/Models/WinningBids.php diff --git a/app/Models/Bidders.php b/app/Models/Bidders.php new file mode 100644 index 0000000..35f6377 --- /dev/null +++ b/app/Models/Bidders.php @@ -0,0 +1,31 @@ +hasMany('App\Models\Checkout', 'bidder_num', 'idbidders'); + } + + public function winningBids() + { + return $this->hasMany('App\Models\WinningBids', 'winning_bidder_num', 'idbidders'); + } +} diff --git a/app/Models/Checkout.php b/app/Models/Checkout.php new file mode 100644 index 0000000..72516c8 --- /dev/null +++ b/app/Models/Checkout.php @@ -0,0 +1,28 @@ +belongsTo('App\Models\Bidders', 'bidder_num', 'idbidders'); + } + + public function paymentMethod() + { + return $this->hasMany('App\Models\PaymentMethods', 'payment_method', 'pm_id'); + } +} diff --git a/app/Models/Items.php b/app/Models/Items.php new file mode 100644 index 0000000..24a4769 --- /dev/null +++ b/app/Models/Items.php @@ -0,0 +1,21 @@ +belongsTo('App\Models\WinningBids', 'winning_item_num', 'iditems'); + } +} diff --git a/app/Models/PaymentMethods.php b/app/Models/PaymentMethods.php new file mode 100644 index 0000000..42f489c --- /dev/null +++ b/app/Models/PaymentMethods.php @@ -0,0 +1,19 @@ +belongsTo('App\Models\Checkout', 'payment_method', 'pm_id'); + } + +} diff --git a/app/Models/WinningBids.php b/app/Models/WinningBids.php new file mode 100644 index 0000000..d5819c1 --- /dev/null +++ b/app/Models/WinningBids.php @@ -0,0 +1,25 @@ +hasMany('App\Models\Items', 'winning_item_num', 'iditems'); + } + + public function bidders() + { + return $this->belongsTo('App\Models\Bidders', 'winning_bidder_num', 'idbidders'); + } +} From 72af40a36490cc69188d432689e864b48441c63e Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:02:54 -0500 Subject: [PATCH 02/66] Convert some helpers to using models --- app/helpers.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/helpers.php b/app/helpers.php index cfc2087..977321f 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -3,16 +3,20 @@ namespace App; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; +use App\Models\Bidders; +use App\Models\Items; class BidderSelectList { public static function BidderShowNumbers() { - $bidder_num_results = DB::select("SELECT - * - FROM bidders - ORDER BY bidder_assigned_number - "); + //$bidder_num_results = DB::select("SELECT + //* + //FROM bidders + //ORDER BY bidder_assigned_number + //"); + $bidder_num_results = Bidders::orderBy('bidder_assigned_number') + ->get(); $bidder_num = ''; foreach($bidder_num_results as $bidder_num_result){ $bidder_num .= ''; From f14e20b22ada51d9d7f1a9f4922740c80e1a88c2 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:09:06 -0500 Subject: [PATCH 03/66] Convert more helpers --- app/helpers.php | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/app/helpers.php b/app/helpers.php index 977321f..2c9db2e 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -5,16 +5,12 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; use App\Models\Bidders; use App\Models\Items; +use App\Models\Checkout; class BidderSelectList { public static function BidderShowNumbers() { - //$bidder_num_results = DB::select("SELECT - //* - //FROM bidders - //ORDER BY bidder_assigned_number - //"); $bidder_num_results = Bidders::orderBy('bidder_assigned_number') ->get(); $bidder_num = ''; @@ -29,14 +25,9 @@ class CheckoutBidderSelectList { public static function CheckoutBidderShowNumbers() { - $checkout_bidder_num_results = DB::select("SELECT - bidder_num, bidders.* - FROM checkout - INNER JOIN bidders AS bidders - ON checkout.bidder_num=bidders.idbidders - GROUP BY bidders.bidder_assigned_number - ORDER BY bidders.bidder_assigned_number - "); + $checkout_bidder_num_results = Checkout::with('bidders') + ->orderBy('bidder_assigned_number') + ->get(); $checkout_bidder_num = ''; foreach($checkout_bidder_num_results as $checkout_bidder_num_result){ $checkout_bidder_num .= ''; From b128a81acaad9f85bb468ba624d57d88270e223b Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:11:53 -0500 Subject: [PATCH 04/66] Convert helpers --- app/helpers.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/helpers.php b/app/helpers.php index 2c9db2e..c6f536f 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -25,7 +25,9 @@ class CheckoutBidderSelectList { public static function CheckoutBidderShowNumbers() { - $checkout_bidder_num_results = Checkout::with('bidders') + $checkout_bidder_num_results = Checkout::with(['bidders' => function ($q) { + $q->orderBy('bidder_assigned_number', 'asc'); + }]) ->orderBy('bidder_assigned_number') ->get(); $checkout_bidder_num = ''; From 257f492190ca2db684c13b3e1288817c076118a5 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:15:11 -0500 Subject: [PATCH 05/66] Convert helpers --- app/helpers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers.php b/app/helpers.php index c6f536f..40008fb 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -28,7 +28,7 @@ class CheckoutBidderSelectList $checkout_bidder_num_results = Checkout::with(['bidders' => function ($q) { $q->orderBy('bidder_assigned_number', 'asc'); }]) - ->orderBy('bidder_assigned_number') + //->orderBy('bidder_assigned_number') ->get(); $checkout_bidder_num = ''; foreach($checkout_bidder_num_results as $checkout_bidder_num_result){ From 5993c337bf1dba56d3c791de59640c14b469f6ae Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:15:59 -0500 Subject: [PATCH 06/66] Convert helpers --- app/Models/Checkout.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/Checkout.php b/app/Models/Checkout.php index 72516c8..a0ea86f 100644 --- a/app/Models/Checkout.php +++ b/app/Models/Checkout.php @@ -16,7 +16,7 @@ class Checkout extends Model 'cc_amount' ]; - public function bidder() + public function bidders() { return $this->belongsTo('App\Models\Bidders', 'bidder_num', 'idbidders'); } From e11c316854bf89d97206e1b3275d2221e94d5213 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:17:22 -0500 Subject: [PATCH 07/66] Convert helpers --- app/helpers.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/helpers.php b/app/helpers.php index 40008fb..d4c8f72 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -28,11 +28,10 @@ class CheckoutBidderSelectList $checkout_bidder_num_results = Checkout::with(['bidders' => function ($q) { $q->orderBy('bidder_assigned_number', 'asc'); }]) - //->orderBy('bidder_assigned_number') ->get(); $checkout_bidder_num = ''; foreach($checkout_bidder_num_results as $checkout_bidder_num_result){ - $checkout_bidder_num .= ''; + $checkout_bidder_num .= ''; } return $checkout_bidder_num; } From 42323840cc03cfa616923b0d2e9bf8d7f9189c77 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:19:00 -0500 Subject: [PATCH 08/66] Convert helpers --- app/helpers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers.php b/app/helpers.php index d4c8f72..4a520b8 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -30,7 +30,7 @@ class CheckoutBidderSelectList }]) ->get(); $checkout_bidder_num = ''; - foreach($checkout_bidder_num_results as $checkout_bidder_num_result){ + foreach($checkout_bidder_num_results->sortBy('bidder_assigned_number') as $checkout_bidder_num_result){ $checkout_bidder_num .= ''; } return $checkout_bidder_num; From dd6fcc95cca30247f577a345ec140a52816221a8 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:20:43 -0500 Subject: [PATCH 09/66] Convert Helpers --- app/helpers.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/helpers.php b/app/helpers.php index 4a520b8..585c96b 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -29,8 +29,9 @@ class CheckoutBidderSelectList $q->orderBy('bidder_assigned_number', 'asc'); }]) ->get(); + dd($checkout_bidder_num_results); $checkout_bidder_num = ''; - foreach($checkout_bidder_num_results->sortBy('bidder_assigned_number') as $checkout_bidder_num_result){ + foreach($checkout_bidder_num_results as $checkout_bidder_num_result){ $checkout_bidder_num .= ''; } return $checkout_bidder_num; From 6e618d048a870ae0e3f08f245b93fe16c5fc9fcc Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:22:52 -0500 Subject: [PATCH 10/66] Convert helpers --- app/Models/Checkout.php | 2 +- app/helpers.php | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/Models/Checkout.php b/app/Models/Checkout.php index a0ea86f..d97d05c 100644 --- a/app/Models/Checkout.php +++ b/app/Models/Checkout.php @@ -18,7 +18,7 @@ class Checkout extends Model public function bidders() { - return $this->belongsTo('App\Models\Bidders', 'bidder_num', 'idbidders'); + return $this->belongsTo('App\Models\Bidders', 'bidder_num', 'idbidders')->orderBy('bidder_assigned_number', 'asc'); } public function paymentMethod() diff --git a/app/helpers.php b/app/helpers.php index 585c96b..9f799ad 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -25,11 +25,8 @@ class CheckoutBidderSelectList { public static function CheckoutBidderShowNumbers() { - $checkout_bidder_num_results = Checkout::with(['bidders' => function ($q) { - $q->orderBy('bidder_assigned_number', 'asc'); - }]) + $checkout_bidder_num_results = Checkout::with('bidders') ->get(); - dd($checkout_bidder_num_results); $checkout_bidder_num = ''; foreach($checkout_bidder_num_results as $checkout_bidder_num_result){ $checkout_bidder_num .= ''; From 89da41c7f62381cd92fe40ca9b8148349b0dea6d Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:25:00 -0500 Subject: [PATCH 11/66] Convert helpers --- app/Models/Checkout.php | 2 +- app/helpers.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Models/Checkout.php b/app/Models/Checkout.php index d97d05c..a0ea86f 100644 --- a/app/Models/Checkout.php +++ b/app/Models/Checkout.php @@ -18,7 +18,7 @@ class Checkout extends Model public function bidders() { - return $this->belongsTo('App\Models\Bidders', 'bidder_num', 'idbidders')->orderBy('bidder_assigned_number', 'asc'); + return $this->belongsTo('App\Models\Bidders', 'bidder_num', 'idbidders'); } public function paymentMethod() diff --git a/app/helpers.php b/app/helpers.php index 9f799ad..b61fe40 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -26,6 +26,7 @@ class CheckoutBidderSelectList public static function CheckoutBidderShowNumbers() { $checkout_bidder_num_results = Checkout::with('bidders') + ->orderBy('bidders.bidder_assigned_number') ->get(); $checkout_bidder_num = ''; foreach($checkout_bidder_num_results as $checkout_bidder_num_result){ From c835f3a252e2ec836f79aaaebaca340ee277d3ec Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:26:25 -0500 Subject: [PATCH 12/66] convert helpers --- app/helpers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers.php b/app/helpers.php index b61fe40..e77b95b 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -26,8 +26,8 @@ class CheckoutBidderSelectList public static function CheckoutBidderShowNumbers() { $checkout_bidder_num_results = Checkout::with('bidders') - ->orderBy('bidders.bidder_assigned_number') ->get(); + $checkout_bidder_num_results = $checkout_bidder_num_results->orderBy('bidder_assigned_number'); $checkout_bidder_num = ''; foreach($checkout_bidder_num_results as $checkout_bidder_num_result){ $checkout_bidder_num .= ''; From 8571ca3e03454bbaf774ef3253111c09c66ae66a Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:27:09 -0500 Subject: [PATCH 13/66] convert helpers --- app/helpers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers.php b/app/helpers.php index e77b95b..49f6ade 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -27,7 +27,7 @@ class CheckoutBidderSelectList { $checkout_bidder_num_results = Checkout::with('bidders') ->get(); - $checkout_bidder_num_results = $checkout_bidder_num_results->orderBy('bidder_assigned_number'); + $checkout_bidder_num_results = $checkout_bidder_num_results->sortBy('bidder_assigned_number'); $checkout_bidder_num = ''; foreach($checkout_bidder_num_results as $checkout_bidder_num_result){ $checkout_bidder_num .= ''; From adfe74dd79f2a8b6d58af95494ce5b619f013001 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:28:49 -0500 Subject: [PATCH 14/66] convert helpers --- app/helpers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers.php b/app/helpers.php index 49f6ade..2e12c56 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -27,7 +27,7 @@ class CheckoutBidderSelectList { $checkout_bidder_num_results = Checkout::with('bidders') ->get(); - $checkout_bidder_num_results = $checkout_bidder_num_results->sortBy('bidder_assigned_number'); + $checkout_bidder_num_results = $checkout_bidder_num_results->bidders->sortBy('bidder_assigned_number'); $checkout_bidder_num = ''; foreach($checkout_bidder_num_results as $checkout_bidder_num_result){ $checkout_bidder_num .= ''; From 4f98a23caf2f87a59933e9a30e3be628ccc2d920 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:30:32 -0500 Subject: [PATCH 15/66] convert helpers --- app/helpers.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers.php b/app/helpers.php index 2e12c56..f2ce33f 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -25,8 +25,8 @@ class CheckoutBidderSelectList { public static function CheckoutBidderShowNumbers() { - $checkout_bidder_num_results = Checkout::with('bidders') - ->get(); + $checkout_bidder_num_results = Checkout:://with('bidders') + get(); $checkout_bidder_num_results = $checkout_bidder_num_results->bidders->sortBy('bidder_assigned_number'); $checkout_bidder_num = ''; foreach($checkout_bidder_num_results as $checkout_bidder_num_result){ From 93fc39731fde93132812934e3256b88a9c691b4b Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:33:40 -0500 Subject: [PATCH 16/66] convert helpers --- app/helpers.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/helpers.php b/app/helpers.php index f2ce33f..28ed6f7 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -25,9 +25,10 @@ class CheckoutBidderSelectList { public static function CheckoutBidderShowNumbers() { - $checkout_bidder_num_results = Checkout:://with('bidders') - get(); - $checkout_bidder_num_results = $checkout_bidder_num_results->bidders->sortBy('bidder_assigned_number'); + $checkout_bidder_num_results = Checkout::join('bidders', 'checkout.winning_bidder_num', '=', 'bidders.idbidders') + ->orderBy('bidders.bidder_assigned_number', 'asc') + ->get(); + $checkout_bidder_num = ''; foreach($checkout_bidder_num_results as $checkout_bidder_num_result){ $checkout_bidder_num .= ''; From 4e3053f9ae8ed16c129358f7fb1d3a100fe1444e Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:34:19 -0500 Subject: [PATCH 17/66] convert helpers --- app/helpers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers.php b/app/helpers.php index 28ed6f7..d403fa8 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -25,7 +25,7 @@ class CheckoutBidderSelectList { public static function CheckoutBidderShowNumbers() { - $checkout_bidder_num_results = Checkout::join('bidders', 'checkout.winning_bidder_num', '=', 'bidders.idbidders') + $checkout_bidder_num_results = Checkout::join('bidders', 'checkout.bidder_num', '=', 'bidders.idbidders') ->orderBy('bidders.bidder_assigned_number', 'asc') ->get(); From b9bef5a3850cd1e3bb34ea9566a4f30664fef5a4 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:36:03 -0500 Subject: [PATCH 18/66] convert helpers --- app/helpers.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/helpers.php b/app/helpers.php index d403fa8..e123f25 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -41,11 +41,8 @@ class ItemSelectList { public static function ItemShowNumbers() { - $item_num_results = DB::select("SELECT - * - FROM items - ORDER BY item_assigned_num - "); + $item_num_results = Items::orderBy('item_assigned_num') + ->get(); $item_nums = ''; foreach($item_num_results as $item_num_result){ $item_nums .= ''; From 33c1f99c66a02ed2e9f43717da37207932787f59 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:37:37 -0500 Subject: [PATCH 19/66] convert helpers --- app/helpers.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/helpers.php b/app/helpers.php index e123f25..378f990 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -6,6 +6,7 @@ use Illuminate\Support\Facades\DB; use App\Models\Bidders; use App\Models\Items; use App\Models\Checkout; +use App\Models\PaymentMethods; class BidderSelectList { @@ -54,11 +55,8 @@ class PaymentMethodSelectList { public static function PaymentShowMethods() { - $payment_method_results = DB::select("SELECT - * - FROM payment_methods - ORDER BY pm_name - "); + $payment_method_results = PaymentMethods::orderBy('pm_name') + ->get(); $payment_methods = ''; foreach($payment_method_results as $payment_method_result){ $payment_methods .= ''; From d37d3a105102265292e8ef9035a088bd5775a2a9 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:41:57 -0500 Subject: [PATCH 20/66] convert helpers --- app/helpers.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/helpers.php b/app/helpers.php index 378f990..02e5c03 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -69,13 +69,9 @@ class WinningBidSelectList { public static function WinningBidShowNumbers() { - $winning_bid_num_results = DB::select("SELECT - * - FROM winning_bids - INNER JOIN items AS items - ON winning_bids.winning_item_num = items.iditems - ORDER BY items.item_assigned_num - "); + $winning_bid_num_results = WinningBids::join('items', 'winning_bids.winning_item_num', '=', 'items.iditems') + ->orderBy('items.item_assigned_num') + ->get(); $winning_bid_num = ''; foreach($winning_bid_num_results as $winning_bid_num_result){ $winning_bid_num .= ''; From 98609a7883bdeb841d050c0ee0ae6df7ed5a0dbe Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:42:40 -0500 Subject: [PATCH 21/66] convert helpers --- app/helpers.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/helpers.php b/app/helpers.php index 02e5c03..635c91e 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -7,6 +7,7 @@ use App\Models\Bidders; use App\Models\Items; use App\Models\Checkout; use App\Models\PaymentMethods; +use App\Models\WinningBids; class BidderSelectList { From ea29b9b6341a9036b60190d80db975849e44b278 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:45:59 -0500 Subject: [PATCH 22/66] convert helpers --- app/helpers.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/helpers.php b/app/helpers.php index 635c91e..92b21e6 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -85,14 +85,12 @@ class WinningBidderSelectList { public static function WinningBidderShowNumbers() { - $winning_bidder_num_results = DB::select("SELECT - winning_bidder_num, bidders.* - FROM winning_bids - INNER JOIN bidders AS bidders - ON winning_bids.winning_bidder_num=bidders.idbidders - GROUP BY winning_bidder_num - ORDER BY winning_bidder_num - "); + + $winning_bidder_num_results = WinningBids::join('bidders', 'winning_bids.winning_bidder_num', '=', 'bidders.idbidders') + ->groupBy('winning_bider_num') + ->orderBy('bidders.bidder_assigned_number') + ->get(); + $winning_bidder_num = ''; foreach($winning_bidder_num_results as $winning_bidder_num_result){ $winning_bidder_num .= ''; From e27c35a69102a3d551e4cb593ffb405ff2adcf3d Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:46:28 -0500 Subject: [PATCH 23/66] typo --- app/helpers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers.php b/app/helpers.php index 92b21e6..6cb431d 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -87,7 +87,7 @@ class WinningBidderSelectList { $winning_bidder_num_results = WinningBids::join('bidders', 'winning_bids.winning_bidder_num', '=', 'bidders.idbidders') - ->groupBy('winning_bider_num') + ->groupBy('winning_bidder_num') ->orderBy('bidders.bidder_assigned_number') ->get(); From 06a020be7412f8aea7c2b14f8898944b58f3f342 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:49:43 -0500 Subject: [PATCH 24/66] Convert controller --- app/Http/Controllers/PagesController.php | 25 ++++++++++-------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index 0c0876f..3d97ed9 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -7,24 +7,19 @@ use Illuminate\Support\Facades\DB; use View; Use App\helpers; use PDF; -//use Converter; +use App\Models\Bidders; +use App\Models\Items; +use App\Models\Checkout; +use App\Models\PaymentMethods; +use App\Models\WinningBids; class PagesController extends Controller { public function home() { - $item_count_result = DB::select("SELECT - count(items.item_assigned_num) AS item_count - FROM items - "); - $bidder_count_result = DB::select("SELECT - count(bidders.bidder_assigned_number) AS bidder_count - FROM bidders - "); - $winner_count_result = DB::select("SELECT - count(winning_bids.idwinning_bids) AS winner_count - FROM winning_bids - "); + $item_count_result = Items::count(); + $bidder_count_result = Bidders::count(); + $winner_count_result = WinningBids::count(); return view('home', ['item_count_result' => $item_count_result, 'bidder_count_result' => $bidder_count_result, 'winner_count_result' => $winner_count_result]); } @@ -234,8 +229,8 @@ class PagesController extends Controller "); //dd($checkout_final_results); $checkout_data = [ - 'checkout_final_results' => $checkout_final_results, - 'checkout_list_results' => $checkout_list_results, + 'checkout_final_results' => $checkout_final_results, + 'checkout_list_results' => $checkout_list_results, 'checkout_info_results' => $checkout_info_results ]; // dd($checkout_data); From dc8ffcf914d22b986531f245a6b0783aa2c47483 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:50:51 -0500 Subject: [PATCH 25/66] convert home view --- resources/views/home.blade.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 0023df1..ff08e23 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -25,19 +25,13 @@ - @foreach($item_count_result as $item_count_result) {{ $item_count_result->item_count }} - @endforeach - @foreach($bidder_count_result as $bidder_count_result) {{ $bidder_count_result->bidder_count }} - @endforeach - @foreach($winner_count_result as $winner_count_result) {{ $winner_count_result->winner_count }} - @endforeach From f225f056386c0626f79f02e90438febef0f57d8f Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:51:27 -0500 Subject: [PATCH 26/66] convert home view --- resources/views/home.blade.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index ff08e23..e4be2c4 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -25,13 +25,13 @@ - {{ $item_count_result->item_count }} + {{ $item_count_result }} - {{ $bidder_count_result->bidder_count }} + {{ $bidder_count_result }} - {{ $winner_count_result->winner_count }} + {{ $winner_count_result }} From 7499abfef2896a600abe0780f47da12622464fe0 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 09:54:54 -0500 Subject: [PATCH 27/66] convert bidderlist view --- app/Http/Controllers/PagesController.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index 3d97ed9..c24e41c 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -25,11 +25,10 @@ class PagesController extends Controller public function bidderlist() { - $bidderlist_results = DB::select("SELECT - * - FROM bidders - ORDER BY bidder_assigned_number ASC, bidder_fname ASC - "); + $bidderlist_results = Bidders::orderBy('bidder_assigned_number', 'asc') + ->orderBy('bidder_lname', 'asc') + ->orderBy('bidder_fname', 'asc') + ->get(); return view('bidderlist', ['bidderlist_results' => $bidderlist_results]); } From f622d6b087f4898067460de20ebd1740f0aad724 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 10:00:52 -0500 Subject: [PATCH 28/66] convert bidder creation --- app/Http/Controllers/PagesController.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index c24e41c..e4ab700 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -46,7 +46,10 @@ class PagesController extends Controller $bidder_phone = $bidder_req->bidderphone; $bidder_email = $bidder_req->bidderemail; $bidder_assigned_number = $bidder_req->biddernum; - $bidder_insert = DB::table('bidders')->insert( + $bidder_insert = Bidders::updateOrCreate( + [ + 'bidder_assigned_number' => $bidder_assigned_number, + ], [ 'bidder_lname' => $bidder_lname , 'bidder_fname' => $bidder_fname , @@ -55,9 +58,9 @@ class PagesController extends Controller 'bidder_state' => $bidder_state , 'bidder_zip' => $bidder_zip , 'bidder_phone' => $bidder_phone , - 'bidder_email' => $bidder_email , - 'bidder_assigned_number' => $bidder_assigned_number + 'bidder_email' => $bidder_email ]); + return redirect('bidders'); } From e36b60af8e192a28075ae988c1387d754830bbac Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 10:08:32 -0500 Subject: [PATCH 29/66] add timestamp columns to tables via migrations --- ...18_12_23_100532_add_timestamps_bidders.php | 30 +++++++++++++++++++ ...8_12_23_100646_add_timestamps_checkout.php | 30 +++++++++++++++++++ ...2018_12_23_100651_add_timestamps_items.php | 30 +++++++++++++++++++ ...2_23_100701_add_timestamps_winningbids.php | 30 +++++++++++++++++++ ...3_100710_add_timestamps_paymentmethods.php | 30 +++++++++++++++++++ 5 files changed, 150 insertions(+) create mode 100644 database/migrations/2018_12_23_100532_add_timestamps_bidders.php create mode 100644 database/migrations/2018_12_23_100646_add_timestamps_checkout.php create mode 100644 database/migrations/2018_12_23_100651_add_timestamps_items.php create mode 100644 database/migrations/2018_12_23_100701_add_timestamps_winningbids.php create mode 100644 database/migrations/2018_12_23_100710_add_timestamps_paymentmethods.php diff --git a/database/migrations/2018_12_23_100532_add_timestamps_bidders.php b/database/migrations/2018_12_23_100532_add_timestamps_bidders.php new file mode 100644 index 0000000..b8b64b1 --- /dev/null +++ b/database/migrations/2018_12_23_100532_add_timestamps_bidders.php @@ -0,0 +1,30 @@ +timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} diff --git a/database/migrations/2018_12_23_100646_add_timestamps_checkout.php b/database/migrations/2018_12_23_100646_add_timestamps_checkout.php new file mode 100644 index 0000000..9dd883b --- /dev/null +++ b/database/migrations/2018_12_23_100646_add_timestamps_checkout.php @@ -0,0 +1,30 @@ +timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} diff --git a/database/migrations/2018_12_23_100651_add_timestamps_items.php b/database/migrations/2018_12_23_100651_add_timestamps_items.php new file mode 100644 index 0000000..911ed46 --- /dev/null +++ b/database/migrations/2018_12_23_100651_add_timestamps_items.php @@ -0,0 +1,30 @@ +timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} diff --git a/database/migrations/2018_12_23_100701_add_timestamps_winningbids.php b/database/migrations/2018_12_23_100701_add_timestamps_winningbids.php new file mode 100644 index 0000000..1b9697e --- /dev/null +++ b/database/migrations/2018_12_23_100701_add_timestamps_winningbids.php @@ -0,0 +1,30 @@ +timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} diff --git a/database/migrations/2018_12_23_100710_add_timestamps_paymentmethods.php b/database/migrations/2018_12_23_100710_add_timestamps_paymentmethods.php new file mode 100644 index 0000000..afd9c9a --- /dev/null +++ b/database/migrations/2018_12_23_100710_add_timestamps_paymentmethods.php @@ -0,0 +1,30 @@ +timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} From 55fa60d28bc26b883bad6b177b1622b84e77be60 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 10:10:58 -0500 Subject: [PATCH 30/66] add timestamp columns to tables --- .../migrations/2018_12_23_100532_add_timestamps_bidders.php | 2 +- .../migrations/2018_12_23_100646_add_timestamps_checkout.php | 2 +- database/migrations/2018_12_23_100651_add_timestamps_items.php | 2 +- .../migrations/2018_12_23_100701_add_timestamps_winningbids.php | 2 +- .../2018_12_23_100710_add_timestamps_paymentmethods.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/database/migrations/2018_12_23_100532_add_timestamps_bidders.php b/database/migrations/2018_12_23_100532_add_timestamps_bidders.php index b8b64b1..0fdd583 100644 --- a/database/migrations/2018_12_23_100532_add_timestamps_bidders.php +++ b/database/migrations/2018_12_23_100532_add_timestamps_bidders.php @@ -13,7 +13,7 @@ class AddTimestampsBidders extends Migration */ public function up() { - Schema::table('bidders', function (Blueprint $table) { + Schema::table('bidders', function ($table) { $table->timestamps(); }); } diff --git a/database/migrations/2018_12_23_100646_add_timestamps_checkout.php b/database/migrations/2018_12_23_100646_add_timestamps_checkout.php index 9dd883b..d273d30 100644 --- a/database/migrations/2018_12_23_100646_add_timestamps_checkout.php +++ b/database/migrations/2018_12_23_100646_add_timestamps_checkout.php @@ -13,7 +13,7 @@ class AddTimestampsCheckout extends Migration */ public function up() { - Schema::table('checkout', function (Blueprint $table) { + Schema::table('checkout', function ($table) { $table->timestamps(); }); } diff --git a/database/migrations/2018_12_23_100651_add_timestamps_items.php b/database/migrations/2018_12_23_100651_add_timestamps_items.php index 911ed46..7d1ad48 100644 --- a/database/migrations/2018_12_23_100651_add_timestamps_items.php +++ b/database/migrations/2018_12_23_100651_add_timestamps_items.php @@ -13,7 +13,7 @@ class AddTimestampsItems extends Migration */ public function up() { - Schema::table('items', function (Blueprint $table) { + Schema::table('items', function ($table) { $table->timestamps(); }); } diff --git a/database/migrations/2018_12_23_100701_add_timestamps_winningbids.php b/database/migrations/2018_12_23_100701_add_timestamps_winningbids.php index 1b9697e..463aec3 100644 --- a/database/migrations/2018_12_23_100701_add_timestamps_winningbids.php +++ b/database/migrations/2018_12_23_100701_add_timestamps_winningbids.php @@ -13,7 +13,7 @@ class AddTimestampsWinningbids extends Migration */ public function up() { - Schema::table('winning_bids', function (Blueprint $table) { + Schema::table('winning_bids', function ($table) { $table->timestamps(); }); } diff --git a/database/migrations/2018_12_23_100710_add_timestamps_paymentmethods.php b/database/migrations/2018_12_23_100710_add_timestamps_paymentmethods.php index afd9c9a..7d0d4bd 100644 --- a/database/migrations/2018_12_23_100710_add_timestamps_paymentmethods.php +++ b/database/migrations/2018_12_23_100710_add_timestamps_paymentmethods.php @@ -13,7 +13,7 @@ class AddTimestampsPaymentmethods extends Migration */ public function up() { - Schema::table('payment_methods', function (Blueprint $table) { + Schema::table('payment_methods', function ($table) { $table->timestamps(); }); } From bf1906e215cc639ee7a61fedba0424bc6c279d5c Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 10:17:10 -0500 Subject: [PATCH 31/66] add timestamp columns to tables --- app/Models/Bidders.php | 9 ++++++++- app/Models/Checkout.php | 9 ++++++++- app/Models/Items.php | 9 ++++++++- app/Models/PaymentMethods.php | 9 ++++++++- app/Models/WinningBids.php | 9 ++++++++- 5 files changed, 40 insertions(+), 5 deletions(-) diff --git a/app/Models/Bidders.php b/app/Models/Bidders.php index 35f6377..01ad27b 100644 --- a/app/Models/Bidders.php +++ b/app/Models/Bidders.php @@ -16,9 +16,16 @@ class Bidders extends Model 'bidder_zip', 'bidder_phone', 'bidder_email', - 'bidder_assigned_number' + 'bidder_assigned_number', + 'created_at', + 'updated_at' ]; + protected $dates = [ + 'created_at', + 'updated_at' + ]; + public function checkout() { return $this->hasMany('App\Models\Checkout', 'bidder_num', 'idbidders'); diff --git a/app/Models/Checkout.php b/app/Models/Checkout.php index a0ea86f..95971ee 100644 --- a/app/Models/Checkout.php +++ b/app/Models/Checkout.php @@ -13,7 +13,14 @@ class Checkout extends Model 'payment_method', 'check_number', 'cc_transaction', - 'cc_amount' + 'cc_amount', + 'created_at', + 'updated_at' + ]; + + protected $dates = [ + 'created_at', + 'updated_at' ]; public function bidders() diff --git a/app/Models/Items.php b/app/Models/Items.php index 24a4769..f67ea56 100644 --- a/app/Models/Items.php +++ b/app/Models/Items.php @@ -11,9 +11,16 @@ class Items extends Model 'item_desc', 'item_min_bid', 'item_est_value', - 'item_assigned_num' + 'item_assigned_num', + 'created_at', + 'updated_at' ]; + protected $dates = [ + 'created_at', + 'updated_at' + ]; + public function winningBids() { return $this->belongsTo('App\Models\WinningBids', 'winning_item_num', 'iditems'); diff --git a/app/Models/PaymentMethods.php b/app/Models/PaymentMethods.php index 42f489c..b289698 100644 --- a/app/Models/PaymentMethods.php +++ b/app/Models/PaymentMethods.php @@ -8,7 +8,14 @@ class PaymentMethods extends Model { protected $table = 'payment_methods'; protected $fillable = [ - 'pm_name' + 'pm_name', + 'created_at', + 'updated_at' + ]; + + protected $dates = [ + 'created_at', + 'updated_at' ]; public function checkout() diff --git a/app/Models/WinningBids.php b/app/Models/WinningBids.php index d5819c1..4c6d596 100644 --- a/app/Models/WinningBids.php +++ b/app/Models/WinningBids.php @@ -10,7 +10,14 @@ class WinningBids extends Model protected $fillable = [ 'winning_bidder_num', 'winning_cost', - 'winning_item_num' + 'winning_item_num', + 'created_at', + 'updated_at' + ]; + + protected $dates = [ + 'created_at', + 'updated_at' ]; public function items() From cd8c610d4a70bef4f77df2b59d07fa55bd7baa54 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 10:26:26 -0500 Subject: [PATCH 32/66] Cleanup --- app/Http/Controllers/PagesController.php | 401 ++++++++++++----------- app/Http/Kernel.php | 2 +- app/Http/Middleware/HttpsRedirect.php | 10 +- app/Models/Bidders.php | 4 +- app/Models/Checkout.php | 30 +- app/Models/Items.php | 22 +- app/Models/PaymentMethods.php | 19 +- app/Models/WinningBids.php | 26 +- app/Providers/AppServiceProvider.php | 2 +- app/helpers.php | 97 +++--- 10 files changed, 308 insertions(+), 305 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index e4ab700..d6f2f3b 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -5,7 +5,7 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; use View; -Use App\helpers; +use App\helpers; use PDF; use App\Models\Bidders; use App\Models\Items; @@ -15,69 +15,73 @@ use App\Models\WinningBids; class PagesController extends Controller { - public function home() - { - $item_count_result = Items::count(); - $bidder_count_result = Bidders::count(); - $winner_count_result = WinningBids::count(); - return view('home', ['item_count_result' => $item_count_result, 'bidder_count_result' => $bidder_count_result, 'winner_count_result' => $winner_count_result]); - } + public function home() + { + $item_count_result = Items::count(); + $bidder_count_result = Bidders::count(); + $winner_count_result = WinningBids::count(); + return view('home', ['item_count_result' => $item_count_result, 'bidder_count_result' => $bidder_count_result, 'winner_count_result' => $winner_count_result]); + } - public function bidderlist() - { - $bidderlist_results = Bidders::orderBy('bidder_assigned_number', 'asc') + public function bidderlist() + { + $bidderlist_results = Bidders::orderBy('bidder_assigned_number', 'asc') ->orderBy('bidder_lname', 'asc') ->orderBy('bidder_fname', 'asc') ->get(); - return view('bidderlist', ['bidderlist_results' => $bidderlist_results]); - } - - public function bidders(Request $bidder_req) - { - if(!$bidder_req->bidderlname){ - return view('bidders'); + return view('bidderlist', ['bidderlist_results' => $bidderlist_results]); } - $bidder_lname = $bidder_req->bidderlname; - $bidder_fname = $bidder_req->bidderfname; - $bidder_addr = $bidder_req->bidderaddr; - $bidder_city = $bidder_req->biddercity; - $bidder_state = $bidder_req->bidderstate; - $bidder_zip = $bidder_req->bidderzip; - $bidder_phone = $bidder_req->bidderphone; - $bidder_email = $bidder_req->bidderemail; - $bidder_assigned_number = $bidder_req->biddernum; - $bidder_insert = Bidders::updateOrCreate( - [ - 'bidder_assigned_number' => $bidder_assigned_number, - ], - [ - 'bidder_lname' => $bidder_lname , - 'bidder_fname' => $bidder_fname , - 'bidder_addr' => $bidder_addr , - 'bidder_city' => $bidder_city , - 'bidder_state' => $bidder_state , - 'bidder_zip' => $bidder_zip , - 'bidder_phone' => $bidder_phone , - 'bidder_email' => $bidder_email - ]); - return redirect('bidders'); - } + public function bidders(Request $bidder_req) + { + if (!$bidder_req->bidderlname) { + return view('bidders'); + } + $bidder_lname = $bidder_req->bidderlname; + $bidder_fname = $bidder_req->bidderfname; + $bidder_addr = $bidder_req->bidderaddr; + $bidder_city = $bidder_req->biddercity; + $bidder_state = $bidder_req->bidderstate; + $bidder_zip = $bidder_req->bidderzip; + $bidder_phone = $bidder_req->bidderphone; + $bidder_email = $bidder_req->bidderemail; + $bidder_assigned_number = $bidder_req->biddernum; + $bidder_insert = Bidders::updateOrCreate( + [ + 'bidder_assigned_number' => $bidder_assigned_number, + ], + [ + 'bidder_lname' => $bidder_lname , + 'bidder_fname' => $bidder_fname , + 'bidder_addr' => $bidder_addr , + 'bidder_city' => $bidder_city , + 'bidder_state' => $bidder_state , + 'bidder_zip' => $bidder_zip , + 'bidder_phone' => $bidder_phone , + 'bidder_email' => $bidder_email + ] + ); - public function checkout(Request $checkout_req) - { - if(!$checkout_req->checkoutbiddernum){ - return view('checkout_select_form'); - } elseif(!$checkout_req->checkout_payment_method){ - $checkout_bidder = $checkout_req->checkoutbiddernum; - $checkout_list_results = DB::select("SELECT + return redirect('bidders'); + } + + public function checkout(Request $checkout_req) + { + if (!$checkout_req->checkoutbiddernum) { + return view('checkout_select_form'); + } elseif (!$checkout_req->checkout_payment_method) { + $checkout_bidder = $checkout_req->checkoutbiddernum; + $checkout_list_results = DB::select("SELECT *, items.item_assigned_num FROM winning_bids INNER JOIN items AS items ON winning_bids.winning_item_num=items.iditems WHERE winning_bidder_num = $checkout_bidder "); - $checkout_info_results = DB::select("SELECT + WinningBids::with('items') + ->where('winning_bidder_num', $checkout_bidder) + ->get(); + $checkout_info_results = DB::select("SELECT winning_bids.*, bidders.*, sum(winning_cost) AS total_cost @@ -87,22 +91,22 @@ class PagesController extends Controller WHERE winning_bidder_num = $checkout_bidder GROUP BY winning_bids.winning_bidder_num "); - return view('checkout', ['checkout_list_results' => $checkout_list_results, 'checkout_info_results' => $checkout_info_results]); - } else { - $winnertotal = $checkout_req->winnertotal; - $bidder_num = $checkout_req->checkoutbiddernum; - $payment_method = $checkout_req->checkout_payment_method; - $check_number = $checkout_req->check_number; - $cc_transaction = $checkout_req->cc_transaction; - $cc_amount = $checkout_req->cc_amount; - $checkout_list_results = DB::select("SELECT + return view('checkout', ['checkout_list_results' => $checkout_list_results, 'checkout_info_results' => $checkout_info_results]); + } else { + $winnertotal = $checkout_req->winnertotal; + $bidder_num = $checkout_req->checkoutbiddernum; + $payment_method = $checkout_req->checkout_payment_method; + $check_number = $checkout_req->check_number; + $cc_transaction = $checkout_req->cc_transaction; + $cc_amount = $checkout_req->cc_amount; + $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_info_results = DB::select("SELECT + $checkout_info_results = DB::select("SELECT winning_bids.*, bidders.*, sum(winning_cost) AS total_cost @@ -112,23 +116,23 @@ class PagesController extends Controller WHERE winning_bidder_num = $bidder_num GROUP BY winning_bids.winning_bidder_num "); - $checkout_result = DB::table('checkout')->insertGetID( - [ - 'bidder_num' => $bidder_num, - 'winnertotal' => $winnertotal, - 'payment_method' => $payment_method, - 'check_number' => $check_number, - 'cc_transaction' => $cc_transaction, - 'cc_amount' => $cc_amount, - ] - ); - return view('checkout_complete', ['checkout_result' => $checkout_result, 'checkout_list_results' => $checkout_list_results, 'checkout_info_results' => $checkout_info_results, 'payment_method' => $payment_method, 'check_number' => $check_number, 'cc_transaction' => $cc_transaction]); + $checkout_result = DB::table('checkout')->insertGetID( + [ + 'bidder_num' => $bidder_num, + 'winnertotal' => $winnertotal, + 'payment_method' => $payment_method, + 'check_number' => $check_number, + 'cc_transaction' => $cc_transaction, + 'cc_amount' => $cc_amount, + ] + ); + return view('checkout_complete', ['checkout_result' => $checkout_result, 'checkout_list_results' => $checkout_list_results, 'checkout_info_results' => $checkout_info_results, 'payment_method' => $payment_method, 'check_number' => $check_number, 'cc_transaction' => $cc_transaction]); + } } - } - public function checkout_complete_list() - { - $checkout_complete_results = DB::select("SELECT + public function checkout_complete_list() + { + $checkout_complete_results = DB::select("SELECT checkout.*, bidders.* FROM checkout @@ -137,31 +141,31 @@ class PagesController extends Controller GROUP BY checkout.bidder_num ORDER BY bidders.bidder_assigned_number ASC "); - return view('checkout_complete_list', ['checkout_complete_results' => $checkout_complete_results]); - } - - public function editwinners(Request $edit_win_req) - { - if(!$edit_win_req->winid){ - return view('editwinners'); + return view('checkout_complete_list', ['checkout_complete_results' => $checkout_complete_results]); } - $winning_bid_id = $edit_win_req->winid; - $winner_bidder = $edit_win_req->winnerbiddernum; - $winner_cost = $edit_win_req->winnerbid; - $winner_insert = DB::table('winning_bids') - ->where('idwinning_bids', $winning_bid_id) - ->update( - [ - 'winning_bidder_num' => $winner_bidder, - 'winning_cost' => $winner_cost - ] - ); - return redirect('editwinners'); - } - public function finaltally() - { - $finaltally_results = DB::select("SELECT + public function editwinners(Request $edit_win_req) + { + if (!$edit_win_req->winid) { + return view('editwinners'); + } + $winning_bid_id = $edit_win_req->winid; + $winner_bidder = $edit_win_req->winnerbiddernum; + $winner_cost = $edit_win_req->winnerbid; + $winner_insert = DB::table('winning_bids') + ->where('idwinning_bids', $winning_bid_id) + ->update( + [ + 'winning_bidder_num' => $winner_bidder, + 'winning_cost' => $winner_cost + ] + ); + return redirect('editwinners'); + } + + public function finaltally() + { + $finaltally_results = DB::select("SELECT winning_bids.*, sum(winning_bids.winning_cost) AS total_due, bidders.* @@ -171,55 +175,56 @@ class PagesController extends Controller GROUP BY winning_bids.winning_bidder_num ORDER BY bidders.bidder_lname "); - return view('finaltally', ['finaltally_results' => $finaltally_results]); - } + return view('finaltally', ['finaltally_results' => $finaltally_results]); + } - public function itemlist() - { - $itemlist_results = DB::select("SELECT + public function itemlist() + { + $itemlist_results = DB::select("SELECT * FROM items ORDER BY item_assigned_num ASC "); - return view('itemlist', ['itemlist_results' => $itemlist_results]); - } - - public function items(Request $items_req) - { - if(!$items_req->itemnum){ - return view('items'); + return view('itemlist', ['itemlist_results' => $itemlist_results]); } - $item_assigned_num = $items_req->itemnum; - $item_desc = $items_req->itemdesc; - $item_min_bid = $items_req->itemminbid; - $items_est_value = $items_req->itemestvalue; - $item_insert = DB::table('items')->insert( - [ - 'item_assigned_num' => $item_assigned_num, - 'item_desc' => $item_desc, - 'item_min_bid' => $item_min_bid, - 'item_est_value' => $items_est_value - ]); - return redirect('items'); - } - public function receiptpdf(Request $receiptpdf_request) - { - $checkoutid = $receiptpdf_request->checkout_id; - $checkout_final_results = DB::select("SELECT + public function items(Request $items_req) + { + if (!$items_req->itemnum) { + return view('items'); + } + $item_assigned_num = $items_req->itemnum; + $item_desc = $items_req->itemdesc; + $item_min_bid = $items_req->itemminbid; + $items_est_value = $items_req->itemestvalue; + $item_insert = DB::table('items')->insert( + [ + 'item_assigned_num' => $item_assigned_num, + 'item_desc' => $item_desc, + 'item_min_bid' => $item_min_bid, + 'item_est_value' => $items_est_value + ] + ); + return redirect('items'); + } + + 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 + $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_info_results = DB::select("SELECT + $checkout_info_results = DB::select("SELECT winning_bids.*, bidders.*, sum(winning_cost) AS total_cost @@ -229,42 +234,42 @@ class PagesController extends Controller WHERE winning_bidder_num = $bidder_num GROUP BY winning_bids.winning_bidder_num "); -//dd($checkout_final_results); - $checkout_data = [ - 'checkout_final_results' => $checkout_final_results, - 'checkout_list_results' => $checkout_list_results, - 'checkout_info_results' => $checkout_info_results - ]; -// dd($checkout_data); - //$pdf = PDF::loadView('receiptpdf', $checkout_data); + //dd($checkout_final_results); + $checkout_data = [ + 'checkout_final_results' => $checkout_final_results, + 'checkout_list_results' => $checkout_list_results, + 'checkout_info_results' => $checkout_info_results + ]; + // dd($checkout_data); + //$pdf = PDF::loadView('receiptpdf', $checkout_data); -//dd($pdf); -// $receiptcontentview = View::make('receiptpdf', $checkout_data); -// $receiptcontent = $receiptcontentview->render(); -// $pdf = PDF::loadHTML($receiptcontent); -// $pdf = PDF::loadView('receiptpdf', $checkout_data); -// return $pdf->stream('receipt.pdf'); - return view('receiptpdf', $checkout_data); - } + //dd($pdf); + // $receiptcontentview = View::make('receiptpdf', $checkout_data); + // $receiptcontent = $receiptcontentview->render(); + // $pdf = PDF::loadHTML($receiptcontent); + // $pdf = PDF::loadView('receiptpdf', $checkout_data); + // return $pdf->stream('receipt.pdf'); + return view('receiptpdf', $checkout_data); + } - public function reprint_receipt(Request $reprint_receipt_req) - { - if(!$reprint_receipt_req->reprintbiddernum){ - return view('reprint_receipt_form'); - } else { - $bidnum=$reprint_receipt_req->reprintbiddernum; - $checkout_id = DB::select("SELECT + public function reprint_receipt(Request $reprint_receipt_req) + { + if (!$reprint_receipt_req->reprintbiddernum) { + return view('reprint_receipt_form'); + } else { + $bidnum=$reprint_receipt_req->reprintbiddernum; + $checkout_id = DB::select("SELECT checkout_id FROM checkout WHERE bidder_num = $bidnum "); - return redirect()->route('receiptpdf', ['checkout_id' => $checkout_id['0']->checkout_id]); + return redirect()->route('receiptpdf', ['checkout_id' => $checkout_id['0']->checkout_id]); + } } - } - public function winnerlist() - { - $winnerlist_results = DB::select("SELECT + public function winnerlist() + { + $winnerlist_results = DB::select("SELECT *, bidders.bidder_assigned_number, items.item_assigned_num FROM winning_bids INNER JOIN bidders as bidders @@ -273,30 +278,30 @@ class PagesController extends Controller ON winning_bids.winning_item_num=items.iditems ORDER BY winning_item_num ASC "); - return view('winnerlist', ['winnerlist_results' => $winnerlist_results]); - } - - public function winners(Request $winners_req) - { - if(!$winners_req->winnerbid){ - return view('winners'); + return view('winnerlist', ['winnerlist_results' => $winnerlist_results]); } - $winner_item = $winners_req->winneritemnum; - $winner_bidder = $winners_req->winnerbiddernum; - $winner_cost = $winners_req->winnerbid; - $winner_insert = DB::table('winning_bids')->insert( - [ - 'winning_item_num' => $winner_item, - 'winning_bidder_num' => $winner_bidder, - 'winning_cost' => $winner_cost - ] - ); - return redirect('winners'); - } - public function winnersbyitem() - { - $winnersbyitem_results = DB::select("SELECT + public function winners(Request $winners_req) + { + if (!$winners_req->winnerbid) { + return view('winners'); + } + $winner_item = $winners_req->winneritemnum; + $winner_bidder = $winners_req->winnerbiddernum; + $winner_cost = $winners_req->winnerbid; + $winner_insert = DB::table('winning_bids')->insert( + [ + 'winning_item_num' => $winner_item, + 'winning_bidder_num' => $winner_bidder, + 'winning_cost' => $winner_cost + ] + ); + return redirect('winners'); + } + + public function winnersbyitem() + { + $winnersbyitem_results = DB::select("SELECT * FROM winning_bids INNER JOIN items as items @@ -305,23 +310,23 @@ class PagesController extends Controller ON winning_bids.winning_bidder_num=bidders.idbidders ORDER BY item_assigned_num ASC "); - return view('winnersbyitem', ['winnersbyitem_results' => $winnersbyitem_results]); - } - - public function winnertotal(Request $winnertotal_req) - { - if(!$winnertotal_req->winnerbiddernum){ - return view('winnertotalform'); + return view('winnersbyitem', ['winnersbyitem_results' => $winnersbyitem_results]); } - $winner_total_bidder = $winnertotal_req->winnerbiddernum; - $winnertotal_list_results = DB::select("SELECT + + public function winnertotal(Request $winnertotal_req) + { + if (!$winnertotal_req->winnerbiddernum) { + return view('winnertotalform'); + } + $winner_total_bidder = $winnertotal_req->winnerbiddernum; + $winnertotal_list_results = DB::select("SELECT *, items.item_assigned_num FROM winning_bids INNER JOIN items AS items ON winning_bids.winning_item_num=items.iditems WHERE winning_bidder_num = $winner_total_bidder "); - $winnertotal_info_results = DB::select("SELECT + $winnertotal_info_results = DB::select("SELECT winning_bids.*, bidders.*, sum(winning_cost) AS total_cost @@ -331,17 +336,17 @@ class PagesController extends Controller WHERE winning_bidder_num = $winner_total_bidder GROUP BY winning_bids.winning_bidder_num "); - return view('winnertotal', ['winnertotal_list_results' => $winnertotal_list_results, 'winnertotal_info_results' => $winnertotal_info_results]); - } + return view('winnertotal', ['winnertotal_list_results' => $winnertotal_list_results, 'winnertotal_info_results' => $winnertotal_info_results]); + } - public function winningbidderlist() - { - $winnerlist_results = DB::select("SELECT + public function winningbidderlist() + { + $winnerlist_results = DB::select("SELECT winning_bidder_num FROM winning_bids GROUP BY winning_bidder_num ORDER BY winning_bidder_num "); - return view('winningbidderlist', ['winnerlist_results' => $winnerlist_results]); - } + return view('winningbidderlist', ['winnerlist_results' => $winnerlist_results]); + } } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 97ee068..9bb788f 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -34,7 +34,7 @@ class Kernel extends HttpKernel \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, - \App\Http\Middleware\HttpsRedirect::class, + \App\Http\Middleware\HttpsRedirect::class, ], 'api' => [ diff --git a/app/Http/Middleware/HttpsRedirect.php b/app/Http/Middleware/HttpsRedirect.php index 2834baf..186ee35 100644 --- a/app/Http/Middleware/HttpsRedirect.php +++ b/app/Http/Middleware/HttpsRedirect.php @@ -13,12 +13,12 @@ class HttpsRedirect * @param \Closure $next * @return mixed */ -public function handle($request, Closure $next) + public function handle($request, Closure $next) { - if (!$request->secure() && env('APP_ENV') === 'prod') { - return redirect()->secure($request->getRequestUri()); - } + if (!$request->secure() && env('APP_ENV') === 'prod') { + return redirect()->secure($request->getRequestUri()); + } - return $next($request); + return $next($request); } } diff --git a/app/Models/Bidders.php b/app/Models/Bidders.php index 01ad27b..bc0e73e 100644 --- a/app/Models/Bidders.php +++ b/app/Models/Bidders.php @@ -28,11 +28,11 @@ class Bidders extends Model public function checkout() { - return $this->hasMany('App\Models\Checkout', 'bidder_num', 'idbidders'); + return $this->hasMany('App\Models\Checkout', 'bidder_num', 'idbidders'); } public function winningBids() { - return $this->hasMany('App\Models\WinningBids', 'winning_bidder_num', 'idbidders'); + return $this->hasMany('App\Models\WinningBids', 'winning_bidder_num', 'idbidders'); } } diff --git a/app/Models/Checkout.php b/app/Models/Checkout.php index 95971ee..5dce4b3 100644 --- a/app/Models/Checkout.php +++ b/app/Models/Checkout.php @@ -6,8 +6,8 @@ use Illuminate\Database\Eloquent\Model; class Checkout extends Model { - protected $table = 'checkout'; - protected $fillable = [ + protected $table = 'checkout'; + protected $fillable = [ 'bidder_num', 'winnertotal', 'payment_method', @@ -16,20 +16,20 @@ class Checkout extends Model 'cc_amount', 'created_at', 'updated_at' - ]; + ]; - protected $dates = [ - 'created_at', - 'updated_at' - ]; + protected $dates = [ + 'created_at', + 'updated_at' + ]; - public function bidders() - { - return $this->belongsTo('App\Models\Bidders', 'bidder_num', 'idbidders'); - } + public function bidders() + { + return $this->belongsTo('App\Models\Bidders', 'bidder_num', 'idbidders'); + } - public function paymentMethod() - { - return $this->hasMany('App\Models\PaymentMethods', 'payment_method', 'pm_id'); - } + public function paymentMethod() + { + return $this->hasMany('App\Models\PaymentMethods', 'payment_method', 'pm_id'); + } } diff --git a/app/Models/Items.php b/app/Models/Items.php index f67ea56..fb7434f 100644 --- a/app/Models/Items.php +++ b/app/Models/Items.php @@ -6,23 +6,23 @@ use Illuminate\Database\Eloquent\Model; class Items extends Model { - protected $table = 'items'; - protected $fillable = [ + protected $table = 'items'; + protected $fillable = [ 'item_desc', 'item_min_bid', 'item_est_value', 'item_assigned_num', 'created_at', 'updated_at' - ]; + ]; - protected $dates = [ - 'created_at', - 'updated_at' - ]; + protected $dates = [ + 'created_at', + 'updated_at' + ]; - public function winningBids() - { - return $this->belongsTo('App\Models\WinningBids', 'winning_item_num', 'iditems'); - } + public function winningBids() + { + return $this->belongsTo('App\Models\WinningBids', 'winning_item_num', 'iditems'); + } } diff --git a/app/Models/PaymentMethods.php b/app/Models/PaymentMethods.php index b289698..f41a829 100644 --- a/app/Models/PaymentMethods.php +++ b/app/Models/PaymentMethods.php @@ -6,21 +6,20 @@ use Illuminate\Database\Eloquent\Model; class PaymentMethods extends Model { - protected $table = 'payment_methods'; - protected $fillable = [ + protected $table = 'payment_methods'; + protected $fillable = [ 'pm_name', 'created_at', 'updated_at' - ]; + ]; - protected $dates = [ + protected $dates = [ 'created_at', 'updated_at' - ]; - - public function checkout() - { - return $this->belongsTo('App\Models\Checkout', 'payment_method', 'pm_id'); - } + ]; + public function checkout() + { + return $this->belongsTo('App\Models\Checkout', 'payment_method', 'pm_id'); + } } diff --git a/app/Models/WinningBids.php b/app/Models/WinningBids.php index 4c6d596..9bc7869 100644 --- a/app/Models/WinningBids.php +++ b/app/Models/WinningBids.php @@ -6,27 +6,27 @@ use Illuminate\Database\Eloquent\Model; class WinningBids extends Model { - protected $table = 'winning_bids'; - protected $fillable = [ + protected $table = 'winning_bids'; + protected $fillable = [ 'winning_bidder_num', 'winning_cost', 'winning_item_num', 'created_at', 'updated_at' - ]; + ]; - protected $dates = [ + protected $dates = [ 'created_at', 'updated_at' - ]; + ]; - public function items() - { - return $this->hasMany('App\Models\Items', 'winning_item_num', 'iditems'); - } + public function items() + { + return $this->hasMany('App\Models\Items', 'winning_item_num', 'iditems'); + } - public function bidders() - { - return $this->belongsTo('App\Models\Bidders', 'winning_bidder_num', 'idbidders'); - } + public function bidders() + { + return $this->belongsTo('App\Models\Bidders', 'winning_bidder_num', 'idbidders'); + } } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index e0a6a96..706c003 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -14,7 +14,7 @@ class AppServiceProvider extends ServiceProvider */ public function boot() { - Schema::defaultStringLength(191); + Schema::defaultStringLength(191); } /** diff --git a/app/helpers.php b/app/helpers.php index 6cb431d..b5fd139 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -11,91 +11,90 @@ use App\Models\WinningBids; class BidderSelectList { - public static function BidderShowNumbers() - { - $bidder_num_results = Bidders::orderBy('bidder_assigned_number') + public static function BidderShowNumbers() + { + $bidder_num_results = Bidders::orderBy('bidder_assigned_number') ->get(); - $bidder_num = ''; - foreach($bidder_num_results as $bidder_num_result){ - $bidder_num .= ''; - } - return $bidder_num; + $bidder_num = ''; + foreach ($bidder_num_results as $bidder_num_result) { + $bidder_num .= ''; + } + return $bidder_num; } } class CheckoutBidderSelectList { - public static function CheckoutBidderShowNumbers() - { - $checkout_bidder_num_results = Checkout::join('bidders', 'checkout.bidder_num', '=', 'bidders.idbidders') + public static function CheckoutBidderShowNumbers() + { + $checkout_bidder_num_results = Checkout::join('bidders', 'checkout.bidder_num', '=', 'bidders.idbidders') ->orderBy('bidders.bidder_assigned_number', 'asc') ->get(); - $checkout_bidder_num = ''; - foreach($checkout_bidder_num_results as $checkout_bidder_num_result){ - $checkout_bidder_num .= ''; - } - return $checkout_bidder_num; + $checkout_bidder_num = ''; + foreach ($checkout_bidder_num_results as $checkout_bidder_num_result) { + $checkout_bidder_num .= ''; + } + return $checkout_bidder_num; } } class ItemSelectList { - public static function ItemShowNumbers() - { - $item_num_results = Items::orderBy('item_assigned_num') + public static function ItemShowNumbers() + { + $item_num_results = Items::orderBy('item_assigned_num') ->get(); - $item_nums = ''; - foreach($item_num_results as $item_num_result){ - $item_nums .= ''; - } - return $item_nums; + $item_nums = ''; + foreach ($item_num_results as $item_num_result) { + $item_nums .= ''; + } + return $item_nums; } } class PaymentMethodSelectList { - public static function PaymentShowMethods() - { - $payment_method_results = PaymentMethods::orderBy('pm_name') + public static function PaymentShowMethods() + { + $payment_method_results = PaymentMethods::orderBy('pm_name') ->get(); - $payment_methods = ''; - foreach($payment_method_results as $payment_method_result){ - $payment_methods .= ''; - } - return $payment_methods; + $payment_methods = ''; + foreach ($payment_method_results as $payment_method_result) { + $payment_methods .= ''; + } + return $payment_methods; } } class WinningBidSelectList { - public static function WinningBidShowNumbers() - { - $winning_bid_num_results = WinningBids::join('items', 'winning_bids.winning_item_num', '=', 'items.iditems') + public static function WinningBidShowNumbers() + { + $winning_bid_num_results = WinningBids::join('items', 'winning_bids.winning_item_num', '=', 'items.iditems') ->orderBy('items.item_assigned_num') ->get(); - $winning_bid_num = ''; - foreach($winning_bid_num_results as $winning_bid_num_result){ - $winning_bid_num .= ''; - } - return $winning_bid_num; + $winning_bid_num = ''; + foreach ($winning_bid_num_results as $winning_bid_num_result) { + $winning_bid_num .= ''; + } + return $winning_bid_num; } } class WinningBidderSelectList { - public static function WinningBidderShowNumbers() - { + public static function WinningBidderShowNumbers() + { - $winning_bidder_num_results = WinningBids::join('bidders', 'winning_bids.winning_bidder_num', '=', 'bidders.idbidders') + $winning_bidder_num_results = WinningBids::join('bidders', 'winning_bids.winning_bidder_num', '=', 'bidders.idbidders') ->groupBy('winning_bidder_num') ->orderBy('bidders.bidder_assigned_number') ->get(); - $winning_bidder_num = ''; - foreach($winning_bidder_num_results as $winning_bidder_num_result){ - $winning_bidder_num .= ''; - } - return $winning_bidder_num; + $winning_bidder_num = ''; + foreach ($winning_bidder_num_results as $winning_bidder_num_result) { + $winning_bidder_num .= ''; + } + return $winning_bidder_num; } } -?> From c814850d3a947b930ffcb8136fdb809aebdfe559 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 10:41:29 -0500 Subject: [PATCH 33/66] Cleanup --- app/Helpers/BidderSelectList.php | 20 ++++ app/Helpers/CheckoutBidderSelectList.php | 30 ++++++ app/Helpers/ItemSelectList.php | 20 ++++ app/Helpers/PaymentMethodSelectList.php | 24 +++++ app/Helpers/WinningBidSelectList.php | 25 +++++ app/Helpers/WinningBidderSelectList.php | 28 +++++ app/Http/Controllers/PagesController.php | 29 +++-- app/helpers.php | 100 ------------------ .../views/checkout_select_form.blade.php | 2 +- resources/views/editwinners.blade.php | 4 +- .../views/reprint_receipt_form.blade.php | 2 +- resources/views/winners.blade.php | 4 +- resources/views/winnertotalform.blade.php | 2 +- routes/web.php | 6 +- 14 files changed, 180 insertions(+), 116 deletions(-) create mode 100644 app/Helpers/BidderSelectList.php create mode 100644 app/Helpers/CheckoutBidderSelectList.php create mode 100644 app/Helpers/ItemSelectList.php create mode 100644 app/Helpers/PaymentMethodSelectList.php create mode 100644 app/Helpers/WinningBidSelectList.php create mode 100644 app/Helpers/WinningBidderSelectList.php delete mode 100644 app/helpers.php diff --git a/app/Helpers/BidderSelectList.php b/app/Helpers/BidderSelectList.php new file mode 100644 index 0000000..b5f0177 --- /dev/null +++ b/app/Helpers/BidderSelectList.php @@ -0,0 +1,20 @@ +get(); + $bidder_num = ''; + foreach ($bidder_num_results as $bidder_num_result) { + $bidder_num .= ''; + } + return $bidder_num; + } +} diff --git a/app/Helpers/CheckoutBidderSelectList.php b/app/Helpers/CheckoutBidderSelectList.php new file mode 100644 index 0000000..23aa587 --- /dev/null +++ b/app/Helpers/CheckoutBidderSelectList.php @@ -0,0 +1,30 @@ +orderBy('bidders.bidder_assigned_number', 'asc') + ->get(); + + $checkout_bidder_num = ''; + foreach ($checkout_bidder_num_results as $checkout_bidder_num_result) { + $checkout_bidder_num .= ''; + } + return $checkout_bidder_num; + } +} diff --git a/app/Helpers/ItemSelectList.php b/app/Helpers/ItemSelectList.php new file mode 100644 index 0000000..4122e34 --- /dev/null +++ b/app/Helpers/ItemSelectList.php @@ -0,0 +1,20 @@ +get(); + $item_nums = ''; + foreach ($item_num_results as $item_num_result) { + $item_nums .= ''; + } + return $item_nums; + } +} diff --git a/app/Helpers/PaymentMethodSelectList.php b/app/Helpers/PaymentMethodSelectList.php new file mode 100644 index 0000000..6cfbd6d --- /dev/null +++ b/app/Helpers/PaymentMethodSelectList.php @@ -0,0 +1,24 @@ +get(); + $payment_methods = ''; + foreach ($payment_method_results as $payment_method_result) { + $payment_methods .= ''; + } + return $payment_methods; + } +} diff --git a/app/Helpers/WinningBidSelectList.php b/app/Helpers/WinningBidSelectList.php new file mode 100644 index 0000000..f33502c --- /dev/null +++ b/app/Helpers/WinningBidSelectList.php @@ -0,0 +1,25 @@ +orderBy('items.item_assigned_num') + ->get(); + $winning_bid_num = ''; + foreach ($winning_bid_num_results as $winning_bid_num_result) { + $winning_bid_num .= ''; + } + return $winning_bid_num; + } +} diff --git a/app/Helpers/WinningBidderSelectList.php b/app/Helpers/WinningBidderSelectList.php new file mode 100644 index 0000000..fb70919 --- /dev/null +++ b/app/Helpers/WinningBidderSelectList.php @@ -0,0 +1,28 @@ +groupBy('winning_bidder_num') + ->orderBy('bidders.bidder_assigned_number') + ->get(); + + $winning_bidder_num = ''; + foreach ($winning_bidder_num_results as $winning_bidder_num_result) { + $winning_bidder_num .= ''; + } + return $winning_bidder_num; + } +} diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index d6f2f3b..7ca178d 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -20,7 +20,11 @@ class PagesController extends Controller $item_count_result = Items::count(); $bidder_count_result = Bidders::count(); $winner_count_result = WinningBids::count(); - return view('home', ['item_count_result' => $item_count_result, 'bidder_count_result' => $bidder_count_result, 'winner_count_result' => $winner_count_result]); + return view('home', [ + 'item_count_result' => $item_count_result, + 'bidder_count_result' => $bidder_count_result, + 'winner_count_result' => $winner_count_result + ]); } public function bidderlist() @@ -91,7 +95,10 @@ class PagesController extends Controller WHERE winning_bidder_num = $checkout_bidder GROUP BY winning_bids.winning_bidder_num "); - return view('checkout', ['checkout_list_results' => $checkout_list_results, 'checkout_info_results' => $checkout_info_results]); + return view('checkout', [ + 'checkout_list_results' => $checkout_list_results, + 'checkout_info_results' => $checkout_info_results + ]); } else { $winnertotal = $checkout_req->winnertotal; $bidder_num = $checkout_req->checkoutbiddernum; @@ -126,11 +133,18 @@ class PagesController extends Controller 'cc_amount' => $cc_amount, ] ); - return view('checkout_complete', ['checkout_result' => $checkout_result, 'checkout_list_results' => $checkout_list_results, 'checkout_info_results' => $checkout_info_results, 'payment_method' => $payment_method, 'check_number' => $check_number, 'cc_transaction' => $cc_transaction]); + return view('checkout_complete', [ + 'checkout_result' => $checkout_result, + 'checkout_list_results' => $checkout_list_results, + 'checkout_info_results' => $checkout_info_results, + 'payment_method' => $payment_method, + 'check_number' => $check_number, + 'cc_transaction' => $cc_transaction + ]); } } - public function checkout_complete_list() + public function checkoutCompleteList() { $checkout_complete_results = DB::select("SELECT checkout.*, @@ -252,7 +266,7 @@ class PagesController extends Controller return view('receiptpdf', $checkout_data); } - public function reprint_receipt(Request $reprint_receipt_req) + public function reprintReceipt(Request $reprint_receipt_req) { if (!$reprint_receipt_req->reprintbiddernum) { return view('reprint_receipt_form'); @@ -336,7 +350,10 @@ class PagesController extends Controller WHERE winning_bidder_num = $winner_total_bidder GROUP BY winning_bids.winning_bidder_num "); - return view('winnertotal', ['winnertotal_list_results' => $winnertotal_list_results, 'winnertotal_info_results' => $winnertotal_info_results]); + return view('winnertotal', [ + 'winnertotal_list_results' => $winnertotal_list_results, + 'winnertotal_info_results' => $winnertotal_info_results + ]); } public function winningbidderlist() diff --git a/app/helpers.php b/app/helpers.php deleted file mode 100644 index b5fd139..0000000 --- a/app/helpers.php +++ /dev/null @@ -1,100 +0,0 @@ -get(); - $bidder_num = ''; - foreach ($bidder_num_results as $bidder_num_result) { - $bidder_num .= ''; - } - return $bidder_num; - } -} - -class CheckoutBidderSelectList -{ - public static function CheckoutBidderShowNumbers() - { - $checkout_bidder_num_results = Checkout::join('bidders', 'checkout.bidder_num', '=', 'bidders.idbidders') - ->orderBy('bidders.bidder_assigned_number', 'asc') - ->get(); - - $checkout_bidder_num = ''; - foreach ($checkout_bidder_num_results as $checkout_bidder_num_result) { - $checkout_bidder_num .= ''; - } - return $checkout_bidder_num; - } -} - -class ItemSelectList -{ - public static function ItemShowNumbers() - { - $item_num_results = Items::orderBy('item_assigned_num') - ->get(); - $item_nums = ''; - foreach ($item_num_results as $item_num_result) { - $item_nums .= ''; - } - return $item_nums; - } -} -class PaymentMethodSelectList -{ - public static function PaymentShowMethods() - { - $payment_method_results = PaymentMethods::orderBy('pm_name') - ->get(); - $payment_methods = ''; - foreach ($payment_method_results as $payment_method_result) { - $payment_methods .= ''; - } - return $payment_methods; - } -} - -class WinningBidSelectList -{ - public static function WinningBidShowNumbers() - { - $winning_bid_num_results = WinningBids::join('items', 'winning_bids.winning_item_num', '=', 'items.iditems') - ->orderBy('items.item_assigned_num') - ->get(); - $winning_bid_num = ''; - foreach ($winning_bid_num_results as $winning_bid_num_result) { - $winning_bid_num .= ''; - } - return $winning_bid_num; - } -} - -class WinningBidderSelectList -{ - public static function WinningBidderShowNumbers() - { - - $winning_bidder_num_results = WinningBids::join('bidders', 'winning_bids.winning_bidder_num', '=', 'bidders.idbidders') - ->groupBy('winning_bidder_num') - ->orderBy('bidders.bidder_assigned_number') - ->get(); - - $winning_bidder_num = ''; - foreach ($winning_bidder_num_results as $winning_bidder_num_result) { - $winning_bidder_num .= ''; - } - return $winning_bidder_num; - } -} diff --git a/resources/views/checkout_select_form.blade.php b/resources/views/checkout_select_form.blade.php index 5f4b0ef..2795560 100644 --- a/resources/views/checkout_select_form.blade.php +++ b/resources/views/checkout_select_form.blade.php @@ -16,7 +16,7 @@
diff --git a/resources/views/editwinners.blade.php b/resources/views/editwinners.blade.php index 2cb8994..0d937f8 100644 --- a/resources/views/editwinners.blade.php +++ b/resources/views/editwinners.blade.php @@ -15,7 +15,7 @@
@@ -25,7 +25,7 @@
diff --git a/resources/views/reprint_receipt_form.blade.php b/resources/views/reprint_receipt_form.blade.php index 834230e..342563f 100644 --- a/resources/views/reprint_receipt_form.blade.php +++ b/resources/views/reprint_receipt_form.blade.php @@ -16,7 +16,7 @@
diff --git a/resources/views/winners.blade.php b/resources/views/winners.blade.php index 0f4c0c4..3dd85bd 100644 --- a/resources/views/winners.blade.php +++ b/resources/views/winners.blade.php @@ -16,7 +16,7 @@
@@ -26,7 +26,7 @@
diff --git a/resources/views/winnertotalform.blade.php b/resources/views/winnertotalform.blade.php index 9d13f0f..d0eec12 100644 --- a/resources/views/winnertotalform.blade.php +++ b/resources/views/winnertotalform.blade.php @@ -16,7 +16,7 @@
diff --git a/routes/web.php b/routes/web.php index aa36d50..d2cbabb 100644 --- a/routes/web.php +++ b/routes/web.php @@ -24,7 +24,7 @@ Route::group(['middleware' => 'auth'], function() { Route::post('bidderlist', [ 'uses' => 'PagesController@bidderlist']); Route::get('checkout', [ 'uses' => 'PagesController@checkout']); Route::post('checkout', [ 'uses' => 'PagesController@checkout']); - Route::get('checkout_complete_list', [ 'uses' => 'PagesController@checkout_complete_list' ]); + Route::get('checkout_complete_list', [ 'uses' => 'PagesController@checkoutCompleteList' ]); Route::get('editwinners', [ 'uses' => 'PagesController@editwinners']); Route::post('editwinners', [ 'uses' => 'PagesController@editwinners']); Route::get('finaltally', [ 'uses' => 'PagesController@finaltally']); @@ -32,8 +32,8 @@ Route::group(['middleware' => 'auth'], function() { Route::post('items', [ 'uses' => 'PagesController@items']); Route::get('itemlist', [ 'uses' => 'PagesController@itemlist']); Route::post('itemlist', [ 'uses' => 'PagesController@itemlist']); - Route::get('reprint_receipt', ['uses' => 'PagesController@reprint_receipt']); - Route::post('reprint_receipt', ['uses' => 'PagesController@reprint_receipt']); + Route::get('reprint_receipt', ['uses' => 'PagesController@reprintReceipt']); + Route::post('reprint_receipt', ['uses' => 'PagesController@reprintReceipt']); Route::get('receiptpdf', ['uses' => 'PagesController@receiptpdf'])->name('receiptpdf'); Route::get('winners', [ 'uses' => 'PagesController@winners']); Route::post('winners', [ 'uses' => 'PagesController@winners']); From 82af926966b5413725a42b47365bb0d56e927fd2 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 10:44:32 -0500 Subject: [PATCH 34/66] cleanup --- app/Helpers/CheckoutBidderSelectList.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/app/Helpers/CheckoutBidderSelectList.php b/app/Helpers/CheckoutBidderSelectList.php index 23aa587..373ef58 100644 --- a/app/Helpers/CheckoutBidderSelectList.php +++ b/app/Helpers/CheckoutBidderSelectList.php @@ -15,15 +15,7 @@ class CheckoutBidderSelectList $checkout_bidder_num = ''; foreach ($checkout_bidder_num_results as $checkout_bidder_num_result) { - $checkout_bidder_num .= ''; + $checkout_bidder_num .= ''; } return $checkout_bidder_num; } From a2e0ce5b2822249cb8807a1583494e78346f8506 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 10:51:40 -0500 Subject: [PATCH 35/66] cleanup --- composer.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e8893aa..c0c920b 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,12 @@ "Tests\\": "tests/" }, "files": [ - "app/helpers.php" + "app/Helpers/BidderSelectList.php", + "app/Helpers/CheckoutBidderSelectList.php", + "app/Helpers/ItemSelectList.php", + "app/Helpers/PaymentMethodSelectList.php", + "app/Helpers/WinningBidderSelectList.php", + "app/Helpers/WinningBidSelectList.php" ] }, From cf603f09b5ba518d8646a614f252b279cc3646e3 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 10:53:16 -0500 Subject: [PATCH 36/66] cleanup --- app/Helpers/CheckoutBidderSelectList.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Helpers/CheckoutBidderSelectList.php b/app/Helpers/CheckoutBidderSelectList.php index 373ef58..9f40fc4 100644 --- a/app/Helpers/CheckoutBidderSelectList.php +++ b/app/Helpers/CheckoutBidderSelectList.php @@ -15,7 +15,15 @@ class CheckoutBidderSelectList $checkout_bidder_num = ''; foreach ($checkout_bidder_num_results as $checkout_bidder_num_result) { - $checkout_bidder_num .= ''; + $checkout_bidder_num .= ''; } return $checkout_bidder_num; } From c171fb529af6fc1d40edd14a0ba3b9f55842e14b Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sun, 23 Dec 2018 11:01:06 -0500 Subject: [PATCH 37/66] cleanup --- app/Helpers/BidderSelectList.php | 12 ++++++++++-- app/Helpers/CheckoutBidderSelectList.php | 2 +- app/Helpers/ItemSelectList.php | 8 ++++++-- app/Helpers/PaymentMethodSelectList.php | 8 ++++++-- app/Helpers/WinningBidSelectList.php | 10 ++++++++-- app/Helpers/WinningBidderSelectList.php | 19 ++++++++++++++++--- .../views/checkout_select_form.blade.php | 2 +- resources/views/editwinners.blade.php | 4 ++-- .../views/reprint_receipt_form.blade.php | 2 +- resources/views/winners.blade.php | 4 ++-- resources/views/winnertotalform.blade.php | 2 +- 11 files changed, 54 insertions(+), 19 deletions(-) diff --git a/app/Helpers/BidderSelectList.php b/app/Helpers/BidderSelectList.php index b5f0177..e87aec8 100644 --- a/app/Helpers/BidderSelectList.php +++ b/app/Helpers/BidderSelectList.php @@ -7,13 +7,21 @@ use App\Models\Bidders; class BidderSelectList { - public static function BidderShowNumbers() + public static function bidderShowNumbers() { $bidder_num_results = Bidders::orderBy('bidder_assigned_number') ->get(); $bidder_num = ''; foreach ($bidder_num_results as $bidder_num_result) { - $bidder_num .= ''; + $bidder_num .= ''; } return $bidder_num; } diff --git a/app/Helpers/CheckoutBidderSelectList.php b/app/Helpers/CheckoutBidderSelectList.php index 9f40fc4..5e9fa85 100644 --- a/app/Helpers/CheckoutBidderSelectList.php +++ b/app/Helpers/CheckoutBidderSelectList.php @@ -7,7 +7,7 @@ use App\Models\Checkout; class CheckoutBidderSelectList { - public static function CheckoutBidderShowNumbers() + public static function checkoutBidderShowNumbers() { $checkout_bidder_num_results = Checkout::join('bidders', 'checkout.bidder_num', '=', 'bidders.idbidders') ->orderBy('bidders.bidder_assigned_number', 'asc') diff --git a/app/Helpers/ItemSelectList.php b/app/Helpers/ItemSelectList.php index 4122e34..2e3ca3a 100644 --- a/app/Helpers/ItemSelectList.php +++ b/app/Helpers/ItemSelectList.php @@ -7,13 +7,17 @@ use App\Models\Items; class ItemSelectList { - public static function ItemShowNumbers() + public static function itemShowNumbers() { $item_num_results = Items::orderBy('item_assigned_num') ->get(); $item_nums = ''; foreach ($item_num_results as $item_num_result) { - $item_nums .= ''; + $item_nums .= ''; } return $item_nums; } diff --git a/app/Helpers/PaymentMethodSelectList.php b/app/Helpers/PaymentMethodSelectList.php index 6cfbd6d..c0fc3cd 100644 --- a/app/Helpers/PaymentMethodSelectList.php +++ b/app/Helpers/PaymentMethodSelectList.php @@ -11,13 +11,17 @@ use App\Models\WinningBids; class PaymentMethodSelectList { - public static function PaymentShowMethods() + public static function paymentShowMethods() { $payment_method_results = PaymentMethods::orderBy('pm_name') ->get(); $payment_methods = ''; foreach ($payment_method_results as $payment_method_result) { - $payment_methods .= ''; + $payment_methods .= ''; } return $payment_methods; } diff --git a/app/Helpers/WinningBidSelectList.php b/app/Helpers/WinningBidSelectList.php index f33502c..8bd04ba 100644 --- a/app/Helpers/WinningBidSelectList.php +++ b/app/Helpers/WinningBidSelectList.php @@ -11,14 +11,20 @@ use App\Models\WinningBids; class WinningBidSelectList { - public static function WinningBidShowNumbers() + public static function winningBidShowNumbers() { $winning_bid_num_results = WinningBids::join('items', 'winning_bids.winning_item_num', '=', 'items.iditems') ->orderBy('items.item_assigned_num') ->get(); $winning_bid_num = ''; foreach ($winning_bid_num_results as $winning_bid_num_result) { - $winning_bid_num .= ''; + $winning_bid_num .= ''; } return $winning_bid_num; } diff --git a/app/Helpers/WinningBidderSelectList.php b/app/Helpers/WinningBidderSelectList.php index fb70919..b2ba4f1 100644 --- a/app/Helpers/WinningBidderSelectList.php +++ b/app/Helpers/WinningBidderSelectList.php @@ -11,17 +11,30 @@ use App\Models\WinningBids; class WinningBidderSelectList { - public static function WinningBidderShowNumbers() + public static function winningBidderShowNumbers() { - $winning_bidder_num_results = WinningBids::join('bidders', 'winning_bids.winning_bidder_num', '=', 'bidders.idbidders') + $winning_bidder_num_results = WinningBids::join( + 'bidders', + 'winning_bids.winning_bidder_num', + '=', + 'bidders.idbidders' + ) ->groupBy('winning_bidder_num') ->orderBy('bidders.bidder_assigned_number') ->get(); $winning_bidder_num = ''; foreach ($winning_bidder_num_results as $winning_bidder_num_result) { - $winning_bidder_num .= ''; + $winning_bidder_num .= ''; } return $winning_bidder_num; } diff --git a/resources/views/checkout_select_form.blade.php b/resources/views/checkout_select_form.blade.php index 2795560..4b57865 100644 --- a/resources/views/checkout_select_form.blade.php +++ b/resources/views/checkout_select_form.blade.php @@ -16,7 +16,7 @@
diff --git a/resources/views/editwinners.blade.php b/resources/views/editwinners.blade.php index 0d937f8..e128f8a 100644 --- a/resources/views/editwinners.blade.php +++ b/resources/views/editwinners.blade.php @@ -15,7 +15,7 @@
@@ -25,7 +25,7 @@
diff --git a/resources/views/reprint_receipt_form.blade.php b/resources/views/reprint_receipt_form.blade.php index 342563f..90b7715 100644 --- a/resources/views/reprint_receipt_form.blade.php +++ b/resources/views/reprint_receipt_form.blade.php @@ -16,7 +16,7 @@
diff --git a/resources/views/winners.blade.php b/resources/views/winners.blade.php index 3dd85bd..90a6f36 100644 --- a/resources/views/winners.blade.php +++ b/resources/views/winners.blade.php @@ -16,7 +16,7 @@
@@ -26,7 +26,7 @@
diff --git a/resources/views/winnertotalform.blade.php b/resources/views/winnertotalform.blade.php index d0eec12..3283f91 100644 --- a/resources/views/winnertotalform.blade.php +++ b/resources/views/winnertotalform.blade.php @@ -16,7 +16,7 @@
From 519ba8452b49ea4ebf221f28a08d189998f53cc3 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Mon, 24 Dec 2018 12:42:54 -0500 Subject: [PATCH 38/66] Convert checkout view --- app/Http/Controllers/PagesController.php | 51 ++++++++---------------- resources/views/checkout.blade.php | 27 +++++-------- 2 files changed, 27 insertions(+), 51 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index 7ca178d..ee7ed8b 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -75,28 +75,17 @@ class PagesController extends Controller return view('checkout_select_form'); } elseif (!$checkout_req->checkout_payment_method) { $checkout_bidder = $checkout_req->checkoutbiddernum; - $checkout_list_results = DB::select("SELECT - *, items.item_assigned_num - FROM winning_bids - INNER JOIN items AS items - ON winning_bids.winning_item_num=items.iditems - WHERE winning_bidder_num = $checkout_bidder - "); - WinningBids::with('items') + $checkout_list_results = WinningBids::with('items') ->where('winning_bidder_num', $checkout_bidder) ->get(); - $checkout_info_results = DB::select("SELECT - winning_bids.*, - bidders.*, - sum(winning_cost) AS total_cost - FROM winning_bids - INNER JOIN bidders AS bidders - ON winning_bids.winning_bidder_num=bidders.idbidders - WHERE winning_bidder_num = $checkout_bidder - GROUP BY winning_bids.winning_bidder_num - "); + $checkout_info_results = WinningBids::with('bidders') + ->where('winning_bidder_num', $checkout_bidder) + ->get(); + $checkout_cost_result = WinningBids::where('winning_bidder_num', $checkout_bidder) + ->sum('winning_cost'); return view('checkout', [ 'checkout_list_results' => $checkout_list_results, + '$checkout_cost_result' => $checkout_cost_result, 'checkout_info_results' => $checkout_info_results ]); } else { @@ -106,23 +95,15 @@ class PagesController extends Controller $check_number = $checkout_req->check_number; $cc_transaction = $checkout_req->cc_transaction; $cc_amount = $checkout_req->cc_amount; - $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_info_results = DB::select("SELECT - winning_bids.*, - bidders.*, - sum(winning_cost) AS total_cost - FROM winning_bids - INNER JOIN bidders AS bidders - ON winning_bids.winning_bidder_num=bidders.idbidders - WHERE winning_bidder_num = $bidder_num - GROUP BY winning_bids.winning_bidder_num - "); + $checkout_list_results = WinningBids::with('items') + ->where('winning_bidder_num', $checkout_bidder) + ->get(); + $checkout_cost_result = WinningBids::where('winning_bidder_num', $checkout_bidder) + ->sum('winning_cost'); + + $checkout_info_results = WinningBids::with('bidders') + ->where('winning_bidder_num', $bidder_num) + ->get(); $checkout_result = DB::table('checkout')->insertGetID( [ 'bidder_num' => $bidder_num, diff --git a/resources/views/checkout.blade.php b/resources/views/checkout.blade.php index a29841d..9fe1bc8 100644 --- a/resources/views/checkout.blade.php +++ b/resources/views/checkout.blade.php @@ -6,48 +6,43 @@
Checkout
-
{{ csrf_field() }} @foreach($checkout_info_results as $checkout_info_result) - @php - $bidnum = $checkout_info_result->idbidders; - $totaldue = $checkout_info_result->total_cost; - @endphp @endforeach @@ -65,7 +60,7 @@ @foreach($checkout_list_results as $checkout_list_result) @endforeach

- Bidder Number: {{ $checkout_info_result->bidder_assigned_number }} + Bidder Number: {{ $checkout_info_result->bidders->bidder_assigned_number }}

- Total: ${{ $checkout_info_result->total_cost }} + Total: ${{ $checkout_cost_result }}

- Name: {{ $checkout_info_result->bidder_fname }} {{ $checkout_info_result->bidder_lname }} + Name: {{ $checkout_info_result->bidders->bidder_fname }} {{ $checkout_info_result->bidders->bidder_lname }} - Phone Number: {{ $checkout_info_result->bidder_phone }} + Phone Number: {{ $checkout_info_result->bidders->bidder_phone }}
- Address: {{ $checkout_info_result->bidder_addr }} + Address: {{ $checkout_info_result->bidders->bidder_addr }} - City: {{ $checkout_info_result->bidder_city }} + City: {{ $checkout_info_result->bidders->bidder_city }} - State: {{ $checkout_info_result->bidder_state }} + State: {{ $checkout_info_result->bidders->bidder_state }} - Zip: {{ $checkout_info_result->bidder_zip }} + Zip: {{ $checkout_info_result->bidders->bidder_zip }}
- {{ $checkout_list_result->item_assigned_num }} + {{ $checkout_list_result->items->item_assigned_num }} ${{ $checkout_list_result->winning_cost }} @@ -109,8 +104,8 @@ - - + + bidders->idbidders }}> From 610b3ca4ad0e02d28187426bc3821ee9f24c7ec1 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Mon, 24 Dec 2018 12:49:25 -0500 Subject: [PATCH 39/66] Convert checkout view --- app/Http/Controllers/PagesController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index ee7ed8b..966236b 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -76,8 +76,8 @@ class PagesController extends Controller } elseif (!$checkout_req->checkout_payment_method) { $checkout_bidder = $checkout_req->checkoutbiddernum; $checkout_list_results = WinningBids::with('items') - ->where('winning_bidder_num', $checkout_bidder) - ->get(); + ->where('winning_bidder_num', $checkout_bidder) + ->get(); $checkout_info_results = WinningBids::with('bidders') ->where('winning_bidder_num', $checkout_bidder) ->get(); From 6360e1ad1097ee16a02420c4afe14b3ab31b73f1 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Mon, 24 Dec 2018 12:54:05 -0500 Subject: [PATCH 40/66] Convert checkout view --- app/Http/Controllers/PagesController.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index 966236b..793ccf9 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -78,14 +78,14 @@ class PagesController extends Controller $checkout_list_results = WinningBids::with('items') ->where('winning_bidder_num', $checkout_bidder) ->get(); - $checkout_info_results = WinningBids::with('bidders') - ->where('winning_bidder_num', $checkout_bidder) - ->get(); - $checkout_cost_result = WinningBids::where('winning_bidder_num', $checkout_bidder) - ->sum('winning_cost'); + $checkout_info_results = WinningBids::with('bidders') + ->where('winning_bidder_num', $checkout_bidder) + ->get(); + $checkout_cost_result = WinningBids::where('winning_bidder_num', $checkout_bidder) + ->sum('winning_cost'); return view('checkout', [ 'checkout_list_results' => $checkout_list_results, - '$checkout_cost_result' => $checkout_cost_result, + 'checkout_cost_result' => $checkout_cost_result, 'checkout_info_results' => $checkout_info_results ]); } else { From 6310dbcb232d72c8991942a8606fda978619e2eb Mon Sep 17 00:00:00 2001 From: Russ Long Date: Mon, 24 Dec 2018 12:57:07 -0500 Subject: [PATCH 41/66] convert checkout --- app/Http/Controllers/PagesController.php | 5 +++-- resources/views/checkout.blade.php | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index 793ccf9..0216bed 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -79,8 +79,9 @@ class PagesController extends Controller ->where('winning_bidder_num', $checkout_bidder) ->get(); $checkout_info_results = WinningBids::with('bidders') - ->where('winning_bidder_num', $checkout_bidder) - ->get(); + ->with('items') + ->where('winning_bidder_num', $checkout_bidder) + ->get(); $checkout_cost_result = WinningBids::where('winning_bidder_num', $checkout_bidder) ->sum('winning_cost'); return view('checkout', [ diff --git a/resources/views/checkout.blade.php b/resources/views/checkout.blade.php index 9fe1bc8..a1e6603 100644 --- a/resources/views/checkout.blade.php +++ b/resources/views/checkout.blade.php @@ -47,7 +47,7 @@
- @if($checkout_list_results) + @if($checkout_info_results) - @foreach($checkout_list_results as $checkout_list_result) + @foreach($checkout_info_results as $checkout_info_result) @endforeach @@ -79,7 +79,7 @@
From cf5780176db8b5cc87849f7b851c7a2ef14fea80 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Mon, 24 Dec 2018 12:59:04 -0500 Subject: [PATCH 42/66] convert checkout --- app/Http/Controllers/PagesController.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index 0216bed..d62d06a 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -75,9 +75,6 @@ class PagesController extends Controller return view('checkout_select_form'); } elseif (!$checkout_req->checkout_payment_method) { $checkout_bidder = $checkout_req->checkoutbiddernum; - $checkout_list_results = WinningBids::with('items') - ->where('winning_bidder_num', $checkout_bidder) - ->get(); $checkout_info_results = WinningBids::with('bidders') ->with('items') ->where('winning_bidder_num', $checkout_bidder) From dba3a3fa034f6c16a0f3158658dbc5de95a087c7 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Mon, 24 Dec 2018 13:02:45 -0500 Subject: [PATCH 43/66] undo checkout conversion --- app/Http/Controllers/PagesController.php | 50 ++++++++++++++++-------- resources/views/checkout.blade.php | 35 ++++++++++------- 2 files changed, 54 insertions(+), 31 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index d62d06a..97f67f7 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -75,15 +75,25 @@ class PagesController extends Controller return view('checkout_select_form'); } elseif (!$checkout_req->checkout_payment_method) { $checkout_bidder = $checkout_req->checkoutbiddernum; - $checkout_info_results = WinningBids::with('bidders') - ->with('items') - ->where('winning_bidder_num', $checkout_bidder) - ->get(); - $checkout_cost_result = WinningBids::where('winning_bidder_num', $checkout_bidder) - ->sum('winning_cost'); + $checkout_list_results = DB::select("SELECT + *, items.item_assigned_num + FROM winning_bids + INNER JOIN items AS items + ON winning_bids.winning_item_num=items.iditems + WHERE winning_bidder_num = $checkout_bidder + "); + $checkout_info_results = DB::select("SELECT + winning_bids.*, + bidders.*, + sum(winning_cost) AS total_cost + FROM winning_bids + INNER JOIN bidders AS bidders + ON winning_bids.winning_bidder_num=bidders.idbidders + WHERE winning_bidder_num = $checkout_bidder + GROUP BY winning_bids.winning_bidder_num + "); return view('checkout', [ 'checkout_list_results' => $checkout_list_results, - 'checkout_cost_result' => $checkout_cost_result, 'checkout_info_results' => $checkout_info_results ]); } else { @@ -93,15 +103,23 @@ class PagesController extends Controller $check_number = $checkout_req->check_number; $cc_transaction = $checkout_req->cc_transaction; $cc_amount = $checkout_req->cc_amount; - $checkout_list_results = WinningBids::with('items') - ->where('winning_bidder_num', $checkout_bidder) - ->get(); - $checkout_cost_result = WinningBids::where('winning_bidder_num', $checkout_bidder) - ->sum('winning_cost'); - - $checkout_info_results = WinningBids::with('bidders') - ->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 + "); + $checkout_info_results = DB::select("SELECT + winning_bids.*, + bidders.*, + sum(winning_cost) AS total_cost + FROM winning_bids + INNER JOIN bidders AS bidders + ON winning_bids.winning_bidder_num=bidders.idbidders + WHERE winning_bidder_num = $bidder_num + GROUP BY winning_bids.winning_bidder_num + "); $checkout_result = DB::table('checkout')->insertGetID( [ 'bidder_num' => $bidder_num, diff --git a/resources/views/checkout.blade.php b/resources/views/checkout.blade.php index a1e6603..a29841d 100644 --- a/resources/views/checkout.blade.php +++ b/resources/views/checkout.blade.php @@ -6,48 +6,53 @@
Checkout
+
{{ csrf_field() }}
@@ -57,13 +57,13 @@ Winning Bid:
- {{ $checkout_list_result->items->item_assigned_num }} + {{ $checkout_info_result->items->item_assigned_num }} - ${{ $checkout_list_result->winning_cost }} + ${{ $checkout_info_result->winning_cost }}
@foreach($checkout_info_results as $checkout_info_result) + @php + $bidnum = $checkout_info_result->idbidders; + $totaldue = $checkout_info_result->total_cost; + @endphp @endforeach

- Bidder Number: {{ $checkout_info_result->bidders->bidder_assigned_number }} + Bidder Number: {{ $checkout_info_result->bidder_assigned_number }}

- Total: ${{ $checkout_cost_result }} + Total: ${{ $checkout_info_result->total_cost }}

- Name: {{ $checkout_info_result->bidders->bidder_fname }} {{ $checkout_info_result->bidders->bidder_lname }} + Name: {{ $checkout_info_result->bidder_fname }} {{ $checkout_info_result->bidder_lname }} - Phone Number: {{ $checkout_info_result->bidders->bidder_phone }} + Phone Number: {{ $checkout_info_result->bidder_phone }}
- Address: {{ $checkout_info_result->bidders->bidder_addr }} + Address: {{ $checkout_info_result->bidder_addr }} - City: {{ $checkout_info_result->bidders->bidder_city }} + City: {{ $checkout_info_result->bidder_city }} - State: {{ $checkout_info_result->bidders->bidder_state }} + State: {{ $checkout_info_result->bidder_state }} - Zip: {{ $checkout_info_result->bidders->bidder_zip }} + Zip: {{ $checkout_info_result->bidder_zip }}
- @if($checkout_info_results) + @if($checkout_list_results) - @foreach($checkout_info_results as $checkout_info_result) + @foreach($checkout_list_results as $checkout_list_result) @endforeach @@ -79,7 +84,7 @@
@@ -104,8 +109,8 @@ - - bidders->idbidders }}> + + From d9f73159a20107964d44282543d1974295a0492f Mon Sep 17 00:00:00 2001 From: Russ Long Date: Mon, 24 Dec 2018 13:03:20 -0500 Subject: [PATCH 44/66] Fix list display --- resources/views/checkout.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/checkout.blade.php b/resources/views/checkout.blade.php index a29841d..ae383f1 100644 --- a/resources/views/checkout.blade.php +++ b/resources/views/checkout.blade.php @@ -84,7 +84,7 @@
From 71b911a7ab98820ad164b0a6e087d8c6eb63da31 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Mon, 24 Dec 2018 13:14:39 -0500 Subject: [PATCH 45/66] convert checkout complete list --- app/Http/Controllers/PagesController.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index 97f67f7..4d6f702 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -143,15 +143,10 @@ class PagesController extends Controller public function checkoutCompleteList() { - $checkout_complete_results = DB::select("SELECT - checkout.*, - bidders.* - FROM checkout - INNER JOIN bidders AS bidders - ON checkout.bidder_num=bidders.idbidders - GROUP BY checkout.bidder_num - ORDER BY bidders.bidder_assigned_number ASC - "); + $checkout_complete_results = Checkout::join('bidders', 'checkout.bidder_num', '=', 'bidders.idbidders') + ->groupBy('bidder_num') + ->orderBy('bidders.bider_assigned_number', 'asc') + ->get(); return view('checkout_complete_list', ['checkout_complete_results' => $checkout_complete_results]); } From a6900c10d86417afdb1b12e42fb537e95c2db261 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Mon, 24 Dec 2018 13:15:41 -0500 Subject: [PATCH 46/66] typo --- app/Http/Controllers/PagesController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index 4d6f702..b5e6379 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -145,7 +145,7 @@ class PagesController extends Controller { $checkout_complete_results = Checkout::join('bidders', 'checkout.bidder_num', '=', 'bidders.idbidders') ->groupBy('bidder_num') - ->orderBy('bidders.bider_assigned_number', 'asc') + ->orderBy('bidders.bidder_assigned_number', 'asc') ->get(); return view('checkout_complete_list', ['checkout_complete_results' => $checkout_complete_results]); } From 4510f9ab8b7ed7f1409898d4252880dac791db51 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Mon, 24 Dec 2018 13:21:56 -0500 Subject: [PATCH 47/66] Convert editwinners and itemlist --- app/Http/Controllers/PagesController.php | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index b5e6379..83dfdd8 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -158,14 +158,13 @@ class PagesController extends Controller $winning_bid_id = $edit_win_req->winid; $winner_bidder = $edit_win_req->winnerbiddernum; $winner_cost = $edit_win_req->winnerbid; - $winner_insert = DB::table('winning_bids') - ->where('idwinning_bids', $winning_bid_id) - ->update( - [ - 'winning_bidder_num' => $winner_bidder, - 'winning_cost' => $winner_cost - ] - ); + $winner_insert = WinningBids::where('idwinning_bids', $winning_bid_id) + ->update( + [ + 'winning_bidder_num' => $winner_bidder, + 'winning_cost' => $winner_cost + ] + ); return redirect('editwinners'); } @@ -186,11 +185,8 @@ class PagesController extends Controller public function itemlist() { - $itemlist_results = DB::select("SELECT - * - FROM items - ORDER BY item_assigned_num ASC - "); + $itemlist_results = Items::orderBy('item_assigned_num', 'asc') + ->get(); return view('itemlist', ['itemlist_results' => $itemlist_results]); } From 4b22f36fac486dda8a927a88e644bab04e4e5f4c Mon Sep 17 00:00:00 2001 From: Russ Long Date: Mon, 24 Dec 2018 13:24:11 -0500 Subject: [PATCH 48/66] cleanup --- app/Http/Controllers/PagesController.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index 83dfdd8..eb1df11 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -236,21 +236,11 @@ class PagesController extends Controller WHERE winning_bidder_num = $bidder_num GROUP BY winning_bids.winning_bidder_num "); - //dd($checkout_final_results); $checkout_data = [ 'checkout_final_results' => $checkout_final_results, 'checkout_list_results' => $checkout_list_results, 'checkout_info_results' => $checkout_info_results ]; - // dd($checkout_data); - //$pdf = PDF::loadView('receiptpdf', $checkout_data); - - //dd($pdf); - // $receiptcontentview = View::make('receiptpdf', $checkout_data); - // $receiptcontent = $receiptcontentview->render(); - // $pdf = PDF::loadHTML($receiptcontent); - // $pdf = PDF::loadView('receiptpdf', $checkout_data); - // return $pdf->stream('receipt.pdf'); return view('receiptpdf', $checkout_data); } From 07b056f6806cd6a448f22d55edb4505ed0301bd4 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Mon, 24 Dec 2018 13:27:49 -0500 Subject: [PATCH 49/66] convert winningbidderlist --- app/Http/Controllers/PagesController.php | 10 ++++------ resources/views/winningbidderlist.blade.php | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index eb1df11..425628a 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -336,12 +336,10 @@ class PagesController extends Controller public function winningbidderlist() { - $winnerlist_results = DB::select("SELECT - winning_bidder_num - FROM winning_bids - GROUP BY winning_bidder_num - ORDER BY winning_bidder_num - "); + $winnerlist_results = WinningBids::join('bidders', 'winning_bids.winning_bidder_num', '=', 'bidders.idbidders') + ->groupBy('winning_bidder_num') + ->orderBy('bidders.bidder_assigned_number') + ->get(); return view('winningbidderlist', ['winnerlist_results' => $winnerlist_results]); } } diff --git a/resources/views/winningbidderlist.blade.php b/resources/views/winningbidderlist.blade.php index 3867544..28f2b94 100644 --- a/resources/views/winningbidderlist.blade.php +++ b/resources/views/winningbidderlist.blade.php @@ -17,7 +17,7 @@ // start first row echo "
"; foreach($winnerlist_results as $winnerlist_result){ - echo ""; + echo ""; // do we need a new row? if($i % 8 === 0){ echo ""; From 055934376e72a61a1d18f6fcaeecd4a9ff2b8317 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Mon, 24 Dec 2018 13:29:48 -0500 Subject: [PATCH 50/66] 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 ""; + echo ""; // do we need a new row? if($i % 6 === 0){ From 4368de155812841f706845898fb76275b2aef80d Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sat, 29 Dec 2018 13:32:00 -0500 Subject: [PATCH 51/66] Convert reprint receipt --- app/Http/Controllers/PagesController.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index 08f7287..bf48215 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -250,12 +250,9 @@ class PagesController extends Controller return view('reprint_receipt_form'); } else { $bidnum=$reprint_receipt_req->reprintbiddernum; - $checkout_id = DB::select("SELECT - checkout_id - FROM checkout - WHERE bidder_num = $bidnum - "); - return redirect()->route('receiptpdf', ['checkout_id' => $checkout_id['0']->checkout_id]); + $checkout_id = Checkout::where('bidder_num', '=', $bidnum) + ->get(); + return redirect()->route('receiptpdf', ['checkout_id' => $checkout_id->checkout_id]); } } From 8b16cef15db99df6a8047cd58839a033ac61fbf9 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sat, 29 Dec 2018 13:34:42 -0500 Subject: [PATCH 52/66] convert reprintreceipt --- app/Http/Controllers/PagesController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index bf48215..499db2f 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -250,9 +250,9 @@ class PagesController extends Controller return view('reprint_receipt_form'); } else { $bidnum=$reprint_receipt_req->reprintbiddernum; - $checkout_id = Checkout::where('bidder_num', '=', $bidnum) + $checkout_result = Checkout::where('bidder_num', '=', $bidnum) ->get(); - return redirect()->route('receiptpdf', ['checkout_id' => $checkout_id->checkout_id]); + return redirect()->route('receiptpdf', ['checkout_id' => $checkout_result->checkout_id]); } } From 3abadcd3bcd053015549e901546da07312d2f70f Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sat, 29 Dec 2018 13:36:56 -0500 Subject: [PATCH 53/66] convert reprintreceipt --- app/Http/Controllers/PagesController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index 499db2f..56b3646 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -251,7 +251,7 @@ class PagesController extends Controller } else { $bidnum=$reprint_receipt_req->reprintbiddernum; $checkout_result = Checkout::where('bidder_num', '=', $bidnum) - ->get(); + ->first(); return redirect()->route('receiptpdf', ['checkout_id' => $checkout_result->checkout_id]); } } From ea9b5bda0753ecb1096e5755732ef168ffcbcdad Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sat, 29 Dec 2018 13:43:36 -0500 Subject: [PATCH 54/66] convert receiptpdf --- app/Http/Controllers/PagesController.php | 19 ++++++------------- resources/views/receiptpdf.blade.php | 12 ++++++------ 2 files changed, 12 insertions(+), 19 deletions(-) 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) @endforeach @@ -181,13 +181,13 @@ @foreach($checkout_list_results as $checkout_list_result) From 35c7acb019a3acc6de3b4d7e452f77d23d7065b7 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sat, 29 Dec 2018 13:45:35 -0500 Subject: [PATCH 55/66] convert receiptpdf --- resources/views/receiptpdf.blade.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/resources/views/receiptpdf.blade.php b/resources/views/receiptpdf.blade.php index 109b259..90ea52c 100644 --- a/resources/views/receiptpdf.blade.php +++ b/resources/views/receiptpdf.blade.php @@ -108,21 +108,19 @@
@@ -57,13 +62,13 @@ Winning Bid:
- {{ $checkout_info_result->items->item_assigned_num }} + {{ $checkout_list_result->item_assigned_num }} - ${{ $checkout_info_result->winning_cost }} + ${{ $checkout_list_result->winning_cost }}

" . $winnerlist_result->winning_bidder_num . "

" . $winnerlist_result->bidders->bidder_assigned_number . "

" . $winnerlist_result->winning_bidder_num . "" . $winnerlist_result->bidders->bidder_assigned_number . "
- {{ $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 }}
- {{ $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 }} - @foreach($checkout_final_results as $checkout_final_result) - @if($checkout_final_result->payment_method==1) + @if($checkout_final_results->payment_method==1)

CASH

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

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

@else

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

@endif - @endforeach
From c2b481aa17947ac80dcc135e74e06ea813436dac Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sat, 29 Dec 2018 13:54:13 -0500 Subject: [PATCH 56/66] convert receiptpdf --- app/Http/Controllers/PagesController.php | 2 +- app/Models/Items.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index 2a58887..ff20517 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -217,7 +217,7 @@ class PagesController extends Controller ->first(); $bidder_num = $checkout_final_results->bidder_num; $checkout_list_results = WinningBids::with('items') - ->where('winning_bidder_num', '=', '$bidder_num') + ->where('winning_bidder_num', '=', $bidder_num) ->get(); $checkout_info_results = DB::select("SELECT winning_bids.*, diff --git a/app/Models/Items.php b/app/Models/Items.php index fb7434f..f6a0f6a 100644 --- a/app/Models/Items.php +++ b/app/Models/Items.php @@ -20,9 +20,9 @@ class Items extends Model 'created_at', 'updated_at' ]; - + public function winningBids() { - return $this->belongsTo('App\Models\WinningBids', 'winning_item_num', 'iditems'); + return $this->belongsTo('App\Models\WinningBids', 'iditems', 'winning_item_num'); } } From b7b19d55a846635199b30c8ad810f91b818e819c Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sat, 29 Dec 2018 14:00:37 -0500 Subject: [PATCH 57/66] convert receiptpdf --- app/Models/WinningBids.php | 2 +- resources/views/receiptpdf.blade.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Models/WinningBids.php b/app/Models/WinningBids.php index 9bc7869..6cf890a 100644 --- a/app/Models/WinningBids.php +++ b/app/Models/WinningBids.php @@ -22,7 +22,7 @@ class WinningBids extends Model public function items() { - return $this->hasMany('App\Models\Items', 'winning_item_num', 'iditems'); + return $this->hasMany('App\Models\Items', 'iditems', 'winning_item_num'); } public function bidders() diff --git a/resources/views/receiptpdf.blade.php b/resources/views/receiptpdf.blade.php index 90ea52c..10a22c1 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->items->item_assigned_num }} + {{ $checkout_list_result->items('item_assigned_num') }} - {{ $checkout_list_result->items->item_desc }} + {{ $checkout_list_result->items('item_desc') }} - ${{ $checkout_list_result->items->winning_cost }} + ${{ $checkout_list_result->winning_cost }} @endforeach From b3e6457458517fae742db2817ae6dc82c074502a Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sat, 29 Dec 2018 14:01:51 -0500 Subject: [PATCH 58/66] convert receiptpdf --- resources/views/receiptpdf.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/receiptpdf.blade.php b/resources/views/receiptpdf.blade.php index 10a22c1..101217f 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('item_assigned_num') }} + {{ $checkout_list_result->items->first()->item_assigned_num }} - {{ $checkout_list_result->items('item_desc') }} + {{ $checkout_list_result->items->first()->item_desc }} ${{ $checkout_list_result->winning_cost }} From 64da341fce1e0cc74e976c1e7abd2177b7a82e1c Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sat, 29 Dec 2018 14:04:08 -0500 Subject: [PATCH 59/66] convert receiptpdf --- app/Http/Controllers/PagesController.php | 2 +- app/Models/WinningBids.php | 2 +- resources/views/receiptpdf.blade.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index ff20517..f018de8 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -216,7 +216,7 @@ 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') + $checkout_list_results = WinningBids::with('items_rel') ->where('winning_bidder_num', '=', $bidder_num) ->get(); $checkout_info_results = DB::select("SELECT diff --git a/app/Models/WinningBids.php b/app/Models/WinningBids.php index 6cf890a..0abc95c 100644 --- a/app/Models/WinningBids.php +++ b/app/Models/WinningBids.php @@ -20,7 +20,7 @@ class WinningBids extends Model 'updated_at' ]; - public function items() + public function items_rel() { 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 101217f..d29a293 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->first()->item_assigned_num }} + {{ $checkout_list_result->items_rel->item_assigned_num }} - {{ $checkout_list_result->items->first()->item_desc }} + {{ $checkout_list_result->items_rel->item_desc }} ${{ $checkout_list_result->winning_cost }} From e2c97b2c7e56fc57453ebe2a6556d97e1133d572 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sat, 29 Dec 2018 14:05:26 -0500 Subject: [PATCH 60/66] convert receiptpdf --- app/Http/Controllers/PagesController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index f018de8..ff20517 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -216,7 +216,7 @@ 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') + $checkout_list_results = WinningBids::with('items') ->where('winning_bidder_num', '=', $bidder_num) ->get(); $checkout_info_results = DB::select("SELECT From 130ef1fd576df26577adb66b2d3a55f3cb84dcd6 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sat, 29 Dec 2018 14:06:26 -0500 Subject: [PATCH 61/66] convert receiptpdf --- app/Http/Controllers/PagesController.php | 2 +- resources/views/receiptpdf.blade.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index ff20517..f018de8 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -216,7 +216,7 @@ 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') + $checkout_list_results = WinningBids::with('items_rel') ->where('winning_bidder_num', '=', $bidder_num) ->get(); $checkout_info_results = DB::select("SELECT diff --git a/resources/views/receiptpdf.blade.php b/resources/views/receiptpdf.blade.php index d29a293..b0e57e1 100644 --- a/resources/views/receiptpdf.blade.php +++ b/resources/views/receiptpdf.blade.php @@ -179,10 +179,10 @@ @foreach($checkout_list_results as $checkout_list_result) - {{ $checkout_list_result->items->item_assigned_num }} + {{ $checkout_list_result->items_rel->item_assigned_num }} - {{ $checkout_list_result->items->item_desc }} + {{ $checkout_list_result->items_rel->item_desc }} ${{ $checkout_list_result->items->winning_cost }} From f986fbf93768c90c64a0deeede3b188d5ab26feb Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sat, 29 Dec 2018 14:08:20 -0500 Subject: [PATCH 62/66] convert receiptpdf --- resources/views/receiptpdf.blade.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/views/receiptpdf.blade.php b/resources/views/receiptpdf.blade.php index b0e57e1..9529157 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->item_assigned_num }} + {{ $checkout_list_result->items_rel->first()->item_assigned_num }} - {{ $checkout_list_result->items_rel->item_desc }} + {{ $checkout_list_result->items_rel->first()->item_desc }} ${{ $checkout_list_result->winning_cost }} @@ -179,10 +179,10 @@ @foreach($checkout_list_results as $checkout_list_result) - {{ $checkout_list_result->items_rel->item_assigned_num }} + {{ $checkout_list_result->items_rel->first()->item_assigned_num }} - {{ $checkout_list_result->items_rel->item_desc }} + {{ $checkout_list_result->items_rel->first()->item_desc }} ${{ $checkout_list_result->items->winning_cost }} From 57f392ef3f5922686fb8669ab3f1f79452ee10ed Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sat, 29 Dec 2018 14:09:40 -0500 Subject: [PATCH 63/66] 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 }} From bdd7465545714735127c2c6fbbf4167edded30e8 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sat, 29 Dec 2018 14:10:38 -0500 Subject: [PATCH 64/66] convert receiptpdf --- resources/views/receiptpdf.blade.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/resources/views/receiptpdf.blade.php b/resources/views/receiptpdf.blade.php index 2238f4d..955a046 100644 --- a/resources/views/receiptpdf.blade.php +++ b/resources/views/receiptpdf.blade.php @@ -108,21 +108,19 @@ - @foreach($checkout_final_results as $checkout_final_result) - @if($checkout_final_result->payment_method==1) + @if($checkout_final_results->payment_method==1)

CASH

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

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

@else

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

@endif - @endforeach From 50ce7f96a38edcaf32d9e5755595f7d9fae55de0 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Sat, 29 Dec 2018 14:11:13 -0500 Subject: [PATCH 65/66] convert receiptpdf --- resources/views/receiptpdf.blade.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/resources/views/receiptpdf.blade.php b/resources/views/receiptpdf.blade.php index 955a046..8fd2529 100644 --- a/resources/views/receiptpdf.blade.php +++ b/resources/views/receiptpdf.blade.php @@ -108,19 +108,19 @@ - @if($checkout_final_results->payment_method==1) -

- CASH -

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

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

- @else -

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

- @endif + @if($checkout_final_results->payment_method==1) +

+ CASH +

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

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

+ @else +

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

+ @endif From 91e9141a3a7c70d5198775029268e6b9257e3207 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Wed, 13 Feb 2019 16:00:41 -0500 Subject: [PATCH 66/66] remove extra code --- app/Http/Controllers/PagesController.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index 3d64f93..0ef6fab 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -223,9 +223,6 @@ class PagesController extends Controller 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.*,