diff --git a/app/Helpers/BidderSelectList.php b/app/Helpers/BidderSelectList.php new file mode 100644 index 0000000..e87aec8 --- /dev/null +++ b/app/Helpers/BidderSelectList.php @@ -0,0 +1,28 @@ +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..5e9fa85 --- /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..2e3ca3a --- /dev/null +++ b/app/Helpers/ItemSelectList.php @@ -0,0 +1,24 @@ +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..c0fc3cd --- /dev/null +++ b/app/Helpers/PaymentMethodSelectList.php @@ -0,0 +1,28 @@ +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..8bd04ba --- /dev/null +++ b/app/Helpers/WinningBidSelectList.php @@ -0,0 +1,31 @@ +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..b2ba4f1 --- /dev/null +++ b/app/Helpers/WinningBidderSelectList.php @@ -0,0 +1,41 @@ +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 0c0876f..0ef6fab 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -5,82 +5,84 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; use View; -Use App\helpers; +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 - "); - 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 = DB::select("SELECT - * - FROM bidders - ORDER BY bidder_assigned_number ASC, bidder_fname ASC - "); - return view('bidderlist', ['bidderlist_results' => $bidderlist_results]); - } - - public function bidders(Request $bidder_req) - { - if(!$bidder_req->bidderlname){ - return view('bidders'); + 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 + ]); } - $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 = DB::table('bidders')->insert( - [ - '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 , - 'bidder_assigned_number' => $bidder_assigned_number - ]); - 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 + 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'); + } + $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 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 + $checkout_info_results = DB::select("SELECT winning_bids.*, bidders.*, sum(winning_cost) AS total_cost @@ -90,22 +92,25 @@ 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 @@ -115,56 +120,57 @@ 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 - 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 - "); - 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'); + public function checkoutCompleteList() + { + $checkout_complete_results = Checkout::join('bidders', 'checkout.bidder_num', '=', 'bidders.idbidders') + ->groupBy('bidder_num') + ->orderBy('bidders.bidder_assigned_number', 'asc') + ->get(); + 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 = WinningBids::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.* @@ -174,55 +180,50 @@ class PagesController extends Controller GROUP BY winning_bids.winning_bidder_num ORDER BY bidders.bidder_lname "); - return view('finaltally', ['finaltally_results' => $finaltally_results]); - } - - 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('finaltally', ['finaltally_results' => $finaltally_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 - * - FROM checkout - WHERE checkout_id = $checkoutid - "); - $bidder_num = $checkout_final_results['0']->bidder_num; - $checkout_list_results = DB::select("SELECT + public function itemlist() + { + $itemlist_results = Items::orderBy('item_assigned_num', 'asc') + ->get(); + return view('itemlist', ['itemlist_results' => $itemlist_results]); + } + + 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 = Checkout::where('checkout_id', '=', $checkoutid) + ->first(); + $bidder_num = $checkout_final_results->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 @@ -232,74 +233,56 @@ 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); - } - - 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]); + $checkout_data = [ + 'checkout_final_results' => $checkout_final_results, + 'checkout_list_results' => $checkout_list_results, + 'checkout_info_results' => $checkout_info_results + ]; + return view('receiptpdf', $checkout_data); } - } - 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 - "); - return view('winnerlist', ['winnerlist_results' => $winnerlist_results]); - } - - public function winners(Request $winners_req) - { - if(!$winners_req->winnerbid){ - return view('winners'); + public function reprintReceipt(Request $reprint_receipt_req) + { + if (!$reprint_receipt_req->reprintbiddernum) { + return view('reprint_receipt_form'); + } else { + $bidnum=$reprint_receipt_req->reprintbiddernum; + $checkout_result = Checkout::where('bidder_num', '=', $bidnum) + ->first(); + return redirect()->route('receiptpdf', ['checkout_id' => $checkout_result->checkout_id]); + } } - $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 winnerlist() + { + $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]); + } + + 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 @@ -308,23 +291,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 @@ -334,17 +317,18 @@ 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 - winning_bidder_num - FROM winning_bids - GROUP BY winning_bidder_num - ORDER BY winning_bidder_num - "); - return view('winningbidderlist', ['winnerlist_results' => $winnerlist_results]); - } + public function winningbidderlist() + { + $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/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 new file mode 100644 index 0000000..bc0e73e --- /dev/null +++ b/app/Models/Bidders.php @@ -0,0 +1,38 @@ +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..5dce4b3 --- /dev/null +++ b/app/Models/Checkout.php @@ -0,0 +1,35 @@ +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..f6a0f6a --- /dev/null +++ b/app/Models/Items.php @@ -0,0 +1,28 @@ +belongsTo('App\Models\WinningBids', 'iditems', 'winning_item_num'); + } +} diff --git a/app/Models/PaymentMethods.php b/app/Models/PaymentMethods.php new file mode 100644 index 0000000..f41a829 --- /dev/null +++ b/app/Models/PaymentMethods.php @@ -0,0 +1,25 @@ +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..6cf890a --- /dev/null +++ b/app/Models/WinningBids.php @@ -0,0 +1,32 @@ +hasMany('App\Models\Items', 'iditems', 'winning_item_num'); + } + + 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 deleted file mode 100644 index cfc2087..0000000 --- a/app/helpers.php +++ /dev/null @@ -1,115 +0,0 @@ -choose...'; - foreach($bidder_num_results as $bidder_num_result){ - $bidder_num .= ''; - } - return $bidder_num; - } -} - -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 = ''; - 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 = DB::select("SELECT - * - FROM items - ORDER BY item_assigned_num - "); - $item_nums = ''; - foreach($item_num_results as $item_num_result){ - $item_nums .= ''; - } - return $item_nums; - } -} -class PaymentMethodSelectList -{ - public static function PaymentShowMethods() - { - $payment_method_results = DB::select("SELECT - * - FROM payment_methods - ORDER BY pm_name - "); - $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 = 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 = ''; - 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 = 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 = ''; - foreach($winning_bidder_num_results as $winning_bidder_num_result){ - $winning_bidder_num .= ''; - } - return $winning_bidder_num; - } -} -?> 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" ] }, 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..0fdd583 --- /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..d273d30 --- /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..7d1ad48 --- /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..463aec3 --- /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..7d0d4bd --- /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() + { + // + } +} 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 @@
diff --git a/resources/views/checkout_select_form.blade.php b/resources/views/checkout_select_form.blade.php index 5f4b0ef..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 2cb8994..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/home.blade.php b/resources/views/home.blade.php index 0023df1..e4be2c4 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 + {{ $item_count_result }} - @foreach($bidder_count_result as $bidder_count_result) - {{ $bidder_count_result->bidder_count }} - @endforeach + {{ $bidder_count_result }} - @foreach($winner_count_result as $winner_count_result) - {{ $winner_count_result->winner_count }} - @endforeach + {{ $winner_count_result }} diff --git a/resources/views/receiptpdf.blade.php b/resources/views/receiptpdf.blade.php index 2238f4d..8fd2529 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) -

- CASH -

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

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

- @else -

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

- @endif - @endforeach + @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 diff --git a/resources/views/reprint_receipt_form.blade.php b/resources/views/reprint_receipt_form.blade.php index 834230e..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/winnerlist.blade.php b/resources/views/winnerlist.blade.php index 7955e84..50057d2 100644 --- a/resources/views/winnerlist.blade.php +++ b/resources/views/winnerlist.blade.php @@ -15,7 +15,7 @@ foreach($winnerlist_results as $winnerlist_result){ - echo "" . $winnerlist_result->winning_bidder_num . ""; + echo "" . $winnerlist_result->bidders->bidder_assigned_number . ""; // do we need a new row? if($i % 6 === 0){ diff --git a/resources/views/winners.blade.php b/resources/views/winners.blade.php index 0f4c0c4..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 9d13f0f..3283f91 100644 --- a/resources/views/winnertotalform.blade.php +++ b/resources/views/winnertotalform.blade.php @@ -16,7 +16,7 @@
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 "

" . $winnerlist_result->winning_bidder_num . "

"; + echo "

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

"; // do we need a new row? if($i % 8 === 0){ echo ""; 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']);