Cleanup
This commit is contained in:
parent
bf1906e215
commit
cd8c610d4a
@ -5,7 +5,7 @@ namespace App\Http\Controllers;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use View;
|
use View;
|
||||||
Use App\helpers;
|
use App\helpers;
|
||||||
use PDF;
|
use PDF;
|
||||||
use App\Models\Bidders;
|
use App\Models\Bidders;
|
||||||
use App\Models\Items;
|
use App\Models\Items;
|
||||||
@ -15,69 +15,73 @@ use App\Models\WinningBids;
|
|||||||
|
|
||||||
class PagesController extends Controller
|
class PagesController extends Controller
|
||||||
{
|
{
|
||||||
public function home()
|
public function home()
|
||||||
{
|
{
|
||||||
$item_count_result = Items::count();
|
$item_count_result = Items::count();
|
||||||
$bidder_count_result = Bidders::count();
|
$bidder_count_result = Bidders::count();
|
||||||
$winner_count_result = WinningBids::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()
|
public function bidderlist()
|
||||||
{
|
{
|
||||||
$bidderlist_results = Bidders::orderBy('bidder_assigned_number', 'asc')
|
$bidderlist_results = Bidders::orderBy('bidder_assigned_number', 'asc')
|
||||||
->orderBy('bidder_lname', 'asc')
|
->orderBy('bidder_lname', 'asc')
|
||||||
->orderBy('bidder_fname', 'asc')
|
->orderBy('bidder_fname', 'asc')
|
||||||
->get();
|
->get();
|
||||||
return view('bidderlist', ['bidderlist_results' => $bidderlist_results]);
|
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 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)
|
return redirect('bidders');
|
||||||
{
|
}
|
||||||
if(!$checkout_req->checkoutbiddernum){
|
|
||||||
return view('checkout_select_form');
|
public function checkout(Request $checkout_req)
|
||||||
} elseif(!$checkout_req->checkout_payment_method){
|
{
|
||||||
$checkout_bidder = $checkout_req->checkoutbiddernum;
|
if (!$checkout_req->checkoutbiddernum) {
|
||||||
$checkout_list_results = DB::select("SELECT
|
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
|
*, items.item_assigned_num
|
||||||
FROM winning_bids
|
FROM winning_bids
|
||||||
INNER JOIN items AS items
|
INNER JOIN items AS items
|
||||||
ON winning_bids.winning_item_num=items.iditems
|
ON winning_bids.winning_item_num=items.iditems
|
||||||
WHERE winning_bidder_num = $checkout_bidder
|
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.*,
|
winning_bids.*,
|
||||||
bidders.*,
|
bidders.*,
|
||||||
sum(winning_cost) AS total_cost
|
sum(winning_cost) AS total_cost
|
||||||
@ -87,22 +91,22 @@ class PagesController extends Controller
|
|||||||
WHERE winning_bidder_num = $checkout_bidder
|
WHERE winning_bidder_num = $checkout_bidder
|
||||||
GROUP BY winning_bids.winning_bidder_num
|
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 {
|
} else {
|
||||||
$winnertotal = $checkout_req->winnertotal;
|
$winnertotal = $checkout_req->winnertotal;
|
||||||
$bidder_num = $checkout_req->checkoutbiddernum;
|
$bidder_num = $checkout_req->checkoutbiddernum;
|
||||||
$payment_method = $checkout_req->checkout_payment_method;
|
$payment_method = $checkout_req->checkout_payment_method;
|
||||||
$check_number = $checkout_req->check_number;
|
$check_number = $checkout_req->check_number;
|
||||||
$cc_transaction = $checkout_req->cc_transaction;
|
$cc_transaction = $checkout_req->cc_transaction;
|
||||||
$cc_amount = $checkout_req->cc_amount;
|
$cc_amount = $checkout_req->cc_amount;
|
||||||
$checkout_list_results = DB::select("SELECT
|
$checkout_list_results = DB::select("SELECT
|
||||||
*, items.item_assigned_num, items.item_desc
|
*, items.item_assigned_num, items.item_desc
|
||||||
FROM winning_bids
|
FROM winning_bids
|
||||||
INNER JOIN items AS items
|
INNER JOIN items AS items
|
||||||
ON winning_bids.winning_item_num=items.iditems
|
ON winning_bids.winning_item_num=items.iditems
|
||||||
WHERE winning_bidder_num = $bidder_num
|
WHERE winning_bidder_num = $bidder_num
|
||||||
");
|
");
|
||||||
$checkout_info_results = DB::select("SELECT
|
$checkout_info_results = DB::select("SELECT
|
||||||
winning_bids.*,
|
winning_bids.*,
|
||||||
bidders.*,
|
bidders.*,
|
||||||
sum(winning_cost) AS total_cost
|
sum(winning_cost) AS total_cost
|
||||||
@ -112,23 +116,23 @@ class PagesController extends Controller
|
|||||||
WHERE winning_bidder_num = $bidder_num
|
WHERE winning_bidder_num = $bidder_num
|
||||||
GROUP BY winning_bids.winning_bidder_num
|
GROUP BY winning_bids.winning_bidder_num
|
||||||
");
|
");
|
||||||
$checkout_result = DB::table('checkout')->insertGetID(
|
$checkout_result = DB::table('checkout')->insertGetID(
|
||||||
[
|
[
|
||||||
'bidder_num' => $bidder_num,
|
'bidder_num' => $bidder_num,
|
||||||
'winnertotal' => $winnertotal,
|
'winnertotal' => $winnertotal,
|
||||||
'payment_method' => $payment_method,
|
'payment_method' => $payment_method,
|
||||||
'check_number' => $check_number,
|
'check_number' => $check_number,
|
||||||
'cc_transaction' => $cc_transaction,
|
'cc_transaction' => $cc_transaction,
|
||||||
'cc_amount' => $cc_amount,
|
'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 checkout_complete_list()
|
||||||
{
|
{
|
||||||
$checkout_complete_results = DB::select("SELECT
|
$checkout_complete_results = DB::select("SELECT
|
||||||
checkout.*,
|
checkout.*,
|
||||||
bidders.*
|
bidders.*
|
||||||
FROM checkout
|
FROM checkout
|
||||||
@ -137,31 +141,31 @@ class PagesController extends Controller
|
|||||||
GROUP BY checkout.bidder_num
|
GROUP BY checkout.bidder_num
|
||||||
ORDER BY bidders.bidder_assigned_number ASC
|
ORDER BY bidders.bidder_assigned_number ASC
|
||||||
");
|
");
|
||||||
return view('checkout_complete_list', ['checkout_complete_results' => $checkout_complete_results]);
|
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');
|
|
||||||
}
|
}
|
||||||
$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()
|
public function editwinners(Request $edit_win_req)
|
||||||
{
|
{
|
||||||
$finaltally_results = DB::select("SELECT
|
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.*,
|
winning_bids.*,
|
||||||
sum(winning_bids.winning_cost) AS total_due,
|
sum(winning_bids.winning_cost) AS total_due,
|
||||||
bidders.*
|
bidders.*
|
||||||
@ -171,55 +175,56 @@ class PagesController extends Controller
|
|||||||
GROUP BY winning_bids.winning_bidder_num
|
GROUP BY winning_bids.winning_bidder_num
|
||||||
ORDER BY bidders.bidder_lname
|
ORDER BY bidders.bidder_lname
|
||||||
");
|
");
|
||||||
return view('finaltally', ['finaltally_results' => $finaltally_results]);
|
return view('finaltally', ['finaltally_results' => $finaltally_results]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function itemlist()
|
public function itemlist()
|
||||||
{
|
{
|
||||||
$itemlist_results = DB::select("SELECT
|
$itemlist_results = DB::select("SELECT
|
||||||
*
|
*
|
||||||
FROM items
|
FROM items
|
||||||
ORDER BY item_assigned_num ASC
|
ORDER BY item_assigned_num ASC
|
||||||
");
|
");
|
||||||
return view('itemlist', ['itemlist_results' => $itemlist_results]);
|
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)
|
public function items(Request $items_req)
|
||||||
{
|
{
|
||||||
$checkoutid = $receiptpdf_request->checkout_id;
|
if (!$items_req->itemnum) {
|
||||||
$checkout_final_results = DB::select("SELECT
|
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
|
FROM checkout
|
||||||
WHERE checkout_id = $checkoutid
|
WHERE checkout_id = $checkoutid
|
||||||
");
|
");
|
||||||
$bidder_num = $checkout_final_results['0']->bidder_num;
|
$bidder_num = $checkout_final_results['0']->bidder_num;
|
||||||
$checkout_list_results = DB::select("SELECT
|
$checkout_list_results = DB::select("SELECT
|
||||||
*, items.item_assigned_num, items.item_desc
|
*, items.item_assigned_num, items.item_desc
|
||||||
FROM winning_bids
|
FROM winning_bids
|
||||||
INNER JOIN items AS items
|
INNER JOIN items AS items
|
||||||
ON winning_bids.winning_item_num=items.iditems
|
ON winning_bids.winning_item_num=items.iditems
|
||||||
WHERE winning_bidder_num = $bidder_num
|
WHERE winning_bidder_num = $bidder_num
|
||||||
");
|
");
|
||||||
$checkout_info_results = DB::select("SELECT
|
$checkout_info_results = DB::select("SELECT
|
||||||
winning_bids.*,
|
winning_bids.*,
|
||||||
bidders.*,
|
bidders.*,
|
||||||
sum(winning_cost) AS total_cost
|
sum(winning_cost) AS total_cost
|
||||||
@ -229,42 +234,42 @@ class PagesController extends Controller
|
|||||||
WHERE winning_bidder_num = $bidder_num
|
WHERE winning_bidder_num = $bidder_num
|
||||||
GROUP BY winning_bids.winning_bidder_num
|
GROUP BY winning_bids.winning_bidder_num
|
||||||
");
|
");
|
||||||
//dd($checkout_final_results);
|
//dd($checkout_final_results);
|
||||||
$checkout_data = [
|
$checkout_data = [
|
||||||
'checkout_final_results' => $checkout_final_results,
|
'checkout_final_results' => $checkout_final_results,
|
||||||
'checkout_list_results' => $checkout_list_results,
|
'checkout_list_results' => $checkout_list_results,
|
||||||
'checkout_info_results' => $checkout_info_results
|
'checkout_info_results' => $checkout_info_results
|
||||||
];
|
];
|
||||||
// dd($checkout_data);
|
// dd($checkout_data);
|
||||||
//$pdf = PDF::loadView('receiptpdf', $checkout_data);
|
//$pdf = PDF::loadView('receiptpdf', $checkout_data);
|
||||||
|
|
||||||
//dd($pdf);
|
//dd($pdf);
|
||||||
// $receiptcontentview = View::make('receiptpdf', $checkout_data);
|
// $receiptcontentview = View::make('receiptpdf', $checkout_data);
|
||||||
// $receiptcontent = $receiptcontentview->render();
|
// $receiptcontent = $receiptcontentview->render();
|
||||||
// $pdf = PDF::loadHTML($receiptcontent);
|
// $pdf = PDF::loadHTML($receiptcontent);
|
||||||
// $pdf = PDF::loadView('receiptpdf', $checkout_data);
|
// $pdf = PDF::loadView('receiptpdf', $checkout_data);
|
||||||
// return $pdf->stream('receipt.pdf');
|
// return $pdf->stream('receipt.pdf');
|
||||||
return view('receiptpdf', $checkout_data);
|
return view('receiptpdf', $checkout_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reprint_receipt(Request $reprint_receipt_req)
|
public function reprint_receipt(Request $reprint_receipt_req)
|
||||||
{
|
{
|
||||||
if(!$reprint_receipt_req->reprintbiddernum){
|
if (!$reprint_receipt_req->reprintbiddernum) {
|
||||||
return view('reprint_receipt_form');
|
return view('reprint_receipt_form');
|
||||||
} else {
|
} else {
|
||||||
$bidnum=$reprint_receipt_req->reprintbiddernum;
|
$bidnum=$reprint_receipt_req->reprintbiddernum;
|
||||||
$checkout_id = DB::select("SELECT
|
$checkout_id = DB::select("SELECT
|
||||||
checkout_id
|
checkout_id
|
||||||
FROM checkout
|
FROM checkout
|
||||||
WHERE bidder_num = $bidnum
|
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()
|
public function winnerlist()
|
||||||
{
|
{
|
||||||
$winnerlist_results = DB::select("SELECT
|
$winnerlist_results = DB::select("SELECT
|
||||||
*, bidders.bidder_assigned_number, items.item_assigned_num
|
*, bidders.bidder_assigned_number, items.item_assigned_num
|
||||||
FROM winning_bids
|
FROM winning_bids
|
||||||
INNER JOIN bidders as bidders
|
INNER JOIN bidders as bidders
|
||||||
@ -273,30 +278,30 @@ class PagesController extends Controller
|
|||||||
ON winning_bids.winning_item_num=items.iditems
|
ON winning_bids.winning_item_num=items.iditems
|
||||||
ORDER BY winning_item_num ASC
|
ORDER BY winning_item_num ASC
|
||||||
");
|
");
|
||||||
return view('winnerlist', ['winnerlist_results' => $winnerlist_results]);
|
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()
|
public function winners(Request $winners_req)
|
||||||
{
|
{
|
||||||
$winnersbyitem_results = DB::select("SELECT
|
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
|
FROM winning_bids
|
||||||
INNER JOIN items as items
|
INNER JOIN items as items
|
||||||
@ -305,23 +310,23 @@ class PagesController extends Controller
|
|||||||
ON winning_bids.winning_bidder_num=bidders.idbidders
|
ON winning_bids.winning_bidder_num=bidders.idbidders
|
||||||
ORDER BY item_assigned_num ASC
|
ORDER BY item_assigned_num ASC
|
||||||
");
|
");
|
||||||
return view('winnersbyitem', ['winnersbyitem_results' => $winnersbyitem_results]);
|
return view('winnersbyitem', ['winnersbyitem_results' => $winnersbyitem_results]);
|
||||||
}
|
|
||||||
|
|
||||||
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
|
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
|
*, items.item_assigned_num
|
||||||
FROM winning_bids
|
FROM winning_bids
|
||||||
INNER JOIN items AS items
|
INNER JOIN items AS items
|
||||||
ON winning_bids.winning_item_num=items.iditems
|
ON winning_bids.winning_item_num=items.iditems
|
||||||
WHERE winning_bidder_num = $winner_total_bidder
|
WHERE winning_bidder_num = $winner_total_bidder
|
||||||
");
|
");
|
||||||
$winnertotal_info_results = DB::select("SELECT
|
$winnertotal_info_results = DB::select("SELECT
|
||||||
winning_bids.*,
|
winning_bids.*,
|
||||||
bidders.*,
|
bidders.*,
|
||||||
sum(winning_cost) AS total_cost
|
sum(winning_cost) AS total_cost
|
||||||
@ -331,17 +336,17 @@ class PagesController extends Controller
|
|||||||
WHERE winning_bidder_num = $winner_total_bidder
|
WHERE winning_bidder_num = $winner_total_bidder
|
||||||
GROUP BY winning_bids.winning_bidder_num
|
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()
|
public function winningbidderlist()
|
||||||
{
|
{
|
||||||
$winnerlist_results = DB::select("SELECT
|
$winnerlist_results = DB::select("SELECT
|
||||||
winning_bidder_num
|
winning_bidder_num
|
||||||
FROM winning_bids
|
FROM winning_bids
|
||||||
GROUP BY winning_bidder_num
|
GROUP BY winning_bidder_num
|
||||||
ORDER BY winning_bidder_num
|
ORDER BY winning_bidder_num
|
||||||
");
|
");
|
||||||
return view('winningbidderlist', ['winnerlist_results' => $winnerlist_results]);
|
return view('winningbidderlist', ['winnerlist_results' => $winnerlist_results]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ class Kernel extends HttpKernel
|
|||||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
\App\Http\Middleware\HttpsRedirect::class,
|
\App\Http\Middleware\HttpsRedirect::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
'api' => [
|
'api' => [
|
||||||
|
@ -13,11 +13,11 @@ class HttpsRedirect
|
|||||||
* @param \Closure $next
|
* @param \Closure $next
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next)
|
public function handle($request, Closure $next)
|
||||||
{
|
{
|
||||||
if (!$request->secure() && env('APP_ENV') === 'prod') {
|
if (!$request->secure() && env('APP_ENV') === 'prod') {
|
||||||
return redirect()->secure($request->getRequestUri());
|
return redirect()->secure($request->getRequestUri());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -28,11 +28,11 @@ class Bidders extends Model
|
|||||||
|
|
||||||
public function checkout()
|
public function checkout()
|
||||||
{
|
{
|
||||||
return $this->hasMany('App\Models\Checkout', 'bidder_num', 'idbidders');
|
return $this->hasMany('App\Models\Checkout', 'bidder_num', 'idbidders');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function winningBids()
|
public function winningBids()
|
||||||
{
|
{
|
||||||
return $this->hasMany('App\Models\WinningBids', 'winning_bidder_num', 'idbidders');
|
return $this->hasMany('App\Models\WinningBids', 'winning_bidder_num', 'idbidders');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
|
|
||||||
class Checkout extends Model
|
class Checkout extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'checkout';
|
protected $table = 'checkout';
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'bidder_num',
|
'bidder_num',
|
||||||
'winnertotal',
|
'winnertotal',
|
||||||
'payment_method',
|
'payment_method',
|
||||||
@ -16,20 +16,20 @@ class Checkout extends Model
|
|||||||
'cc_amount',
|
'cc_amount',
|
||||||
'created_at',
|
'created_at',
|
||||||
'updated_at'
|
'updated_at'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $dates = [
|
protected $dates = [
|
||||||
'created_at',
|
'created_at',
|
||||||
'updated_at'
|
'updated_at'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function bidders()
|
public function bidders()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\Bidders', 'bidder_num', 'idbidders');
|
return $this->belongsTo('App\Models\Bidders', 'bidder_num', 'idbidders');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function paymentMethod()
|
public function paymentMethod()
|
||||||
{
|
{
|
||||||
return $this->hasMany('App\Models\PaymentMethods', 'payment_method', 'pm_id');
|
return $this->hasMany('App\Models\PaymentMethods', 'payment_method', 'pm_id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,23 +6,23 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
|
|
||||||
class Items extends Model
|
class Items extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'items';
|
protected $table = 'items';
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'item_desc',
|
'item_desc',
|
||||||
'item_min_bid',
|
'item_min_bid',
|
||||||
'item_est_value',
|
'item_est_value',
|
||||||
'item_assigned_num',
|
'item_assigned_num',
|
||||||
'created_at',
|
'created_at',
|
||||||
'updated_at'
|
'updated_at'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $dates = [
|
protected $dates = [
|
||||||
'created_at',
|
'created_at',
|
||||||
'updated_at'
|
'updated_at'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function winningBids()
|
public function winningBids()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\WinningBids', 'winning_item_num', 'iditems');
|
return $this->belongsTo('App\Models\WinningBids', 'winning_item_num', 'iditems');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,21 +6,20 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
|
|
||||||
class PaymentMethods extends Model
|
class PaymentMethods extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'payment_methods';
|
protected $table = 'payment_methods';
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'pm_name',
|
'pm_name',
|
||||||
'created_at',
|
'created_at',
|
||||||
'updated_at'
|
'updated_at'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $dates = [
|
protected $dates = [
|
||||||
'created_at',
|
'created_at',
|
||||||
'updated_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');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,27 +6,27 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
|
|
||||||
class WinningBids extends Model
|
class WinningBids extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'winning_bids';
|
protected $table = 'winning_bids';
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'winning_bidder_num',
|
'winning_bidder_num',
|
||||||
'winning_cost',
|
'winning_cost',
|
||||||
'winning_item_num',
|
'winning_item_num',
|
||||||
'created_at',
|
'created_at',
|
||||||
'updated_at'
|
'updated_at'
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $dates = [
|
protected $dates = [
|
||||||
'created_at',
|
'created_at',
|
||||||
'updated_at'
|
'updated_at'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function items()
|
public function items()
|
||||||
{
|
{
|
||||||
return $this->hasMany('App\Models\Items', 'winning_item_num', 'iditems');
|
return $this->hasMany('App\Models\Items', 'winning_item_num', 'iditems');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function bidders()
|
public function bidders()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\Bidders', 'winning_bidder_num', 'idbidders');
|
return $this->belongsTo('App\Models\Bidders', 'winning_bidder_num', 'idbidders');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
Schema::defaultStringLength(191);
|
Schema::defaultStringLength(191);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,91 +11,90 @@ use App\Models\WinningBids;
|
|||||||
|
|
||||||
class BidderSelectList
|
class BidderSelectList
|
||||||
{
|
{
|
||||||
public static function BidderShowNumbers()
|
public static function BidderShowNumbers()
|
||||||
{
|
{
|
||||||
$bidder_num_results = Bidders::orderBy('bidder_assigned_number')
|
$bidder_num_results = Bidders::orderBy('bidder_assigned_number')
|
||||||
->get();
|
->get();
|
||||||
$bidder_num = '<option disabled selected hidden value="">choose...</option>';
|
$bidder_num = '<option disabled selected hidden value="">choose...</option>';
|
||||||
foreach($bidder_num_results as $bidder_num_result){
|
foreach ($bidder_num_results as $bidder_num_result) {
|
||||||
$bidder_num .= '<option value="' . $bidder_num_result->idbidders . '">' . $bidder_num_result->bidder_assigned_number . ' - ' . $bidder_num_result->bidder_fname . ' ' . $bidder_num_result->bidder_lname .'</option>';
|
$bidder_num .= '<option value="' . $bidder_num_result->idbidders . '">' . $bidder_num_result->bidder_assigned_number . ' - ' . $bidder_num_result->bidder_fname . ' ' . $bidder_num_result->bidder_lname .'</option>';
|
||||||
}
|
}
|
||||||
return $bidder_num;
|
return $bidder_num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CheckoutBidderSelectList
|
class CheckoutBidderSelectList
|
||||||
{
|
{
|
||||||
public static function CheckoutBidderShowNumbers()
|
public static function CheckoutBidderShowNumbers()
|
||||||
{
|
{
|
||||||
$checkout_bidder_num_results = Checkout::join('bidders', 'checkout.bidder_num', '=', 'bidders.idbidders')
|
$checkout_bidder_num_results = Checkout::join('bidders', 'checkout.bidder_num', '=', 'bidders.idbidders')
|
||||||
->orderBy('bidders.bidder_assigned_number', 'asc')
|
->orderBy('bidders.bidder_assigned_number', 'asc')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
$checkout_bidder_num = '<option disabled selected hidden value="">choose...</option>';
|
$checkout_bidder_num = '<option disabled selected hidden value="">choose...</option>';
|
||||||
foreach($checkout_bidder_num_results as $checkout_bidder_num_result){
|
foreach ($checkout_bidder_num_results as $checkout_bidder_num_result) {
|
||||||
$checkout_bidder_num .= '<option value="' . $checkout_bidder_num_result->bidders->idbidders . '">' . $checkout_bidder_num_result->bidders->bidder_assigned_number . ' - ' . $checkout_bidder_num_result->bidders->bidder_fname . ' ' . $checkout_bidder_num_result->bidders->bidder_lname .'</option>';
|
$checkout_bidder_num .= '<option value="' . $checkout_bidder_num_result->bidders->idbidders . '">' . $checkout_bidder_num_result->bidders->bidder_assigned_number . ' - ' . $checkout_bidder_num_result->bidders->bidder_fname . ' ' . $checkout_bidder_num_result->bidders->bidder_lname .'</option>';
|
||||||
}
|
}
|
||||||
return $checkout_bidder_num;
|
return $checkout_bidder_num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ItemSelectList
|
class ItemSelectList
|
||||||
{
|
{
|
||||||
public static function ItemShowNumbers()
|
public static function ItemShowNumbers()
|
||||||
{
|
{
|
||||||
$item_num_results = Items::orderBy('item_assigned_num')
|
$item_num_results = Items::orderBy('item_assigned_num')
|
||||||
->get();
|
->get();
|
||||||
$item_nums = '<option disabled="disabled" selected="selected" value="0">choose...</option>';
|
$item_nums = '<option disabled="disabled" selected="selected" value="0">choose...</option>';
|
||||||
foreach($item_num_results as $item_num_result){
|
foreach ($item_num_results as $item_num_result) {
|
||||||
$item_nums .= '<option value="' . $item_num_result->iditems . '">' . $item_num_result->item_assigned_num . '</option>';
|
$item_nums .= '<option value="' . $item_num_result->iditems . '">' . $item_num_result->item_assigned_num . '</option>';
|
||||||
}
|
}
|
||||||
return $item_nums;
|
return $item_nums;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class PaymentMethodSelectList
|
class PaymentMethodSelectList
|
||||||
{
|
{
|
||||||
public static function PaymentShowMethods()
|
public static function PaymentShowMethods()
|
||||||
{
|
{
|
||||||
$payment_method_results = PaymentMethods::orderBy('pm_name')
|
$payment_method_results = PaymentMethods::orderBy('pm_name')
|
||||||
->get();
|
->get();
|
||||||
$payment_methods = '<option disabled="disabled" selected="selected" value="0">choose...</option>';
|
$payment_methods = '<option disabled="disabled" selected="selected" value="0">choose...</option>';
|
||||||
foreach($payment_method_results as $payment_method_result){
|
foreach ($payment_method_results as $payment_method_result) {
|
||||||
$payment_methods .= '<option value="' . $payment_method_result->pm_id . '">' . $payment_method_result->pm_name . '</option>';
|
$payment_methods .= '<option value="' . $payment_method_result->pm_id . '">' . $payment_method_result->pm_name . '</option>';
|
||||||
}
|
}
|
||||||
return $payment_methods;
|
return $payment_methods;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class WinningBidSelectList
|
class WinningBidSelectList
|
||||||
{
|
{
|
||||||
public static function WinningBidShowNumbers()
|
public static function WinningBidShowNumbers()
|
||||||
{
|
{
|
||||||
$winning_bid_num_results = WinningBids::join('items', 'winning_bids.winning_item_num', '=', 'items.iditems')
|
$winning_bid_num_results = WinningBids::join('items', 'winning_bids.winning_item_num', '=', 'items.iditems')
|
||||||
->orderBy('items.item_assigned_num')
|
->orderBy('items.item_assigned_num')
|
||||||
->get();
|
->get();
|
||||||
$winning_bid_num = '<option disabled selected hidden value="">choose...</option>';
|
$winning_bid_num = '<option disabled selected hidden value="">choose...</option>';
|
||||||
foreach($winning_bid_num_results as $winning_bid_num_result){
|
foreach ($winning_bid_num_results as $winning_bid_num_result) {
|
||||||
$winning_bid_num .= '<option value="' . $winning_bid_num_result->idwinning_bids . '">' . $winning_bid_num_result->item_assigned_num . ' - ' . $winning_bid_num_result->item_desc .'</option>';
|
$winning_bid_num .= '<option value="' . $winning_bid_num_result->idwinning_bids . '">' . $winning_bid_num_result->item_assigned_num . ' - ' . $winning_bid_num_result->item_desc .'</option>';
|
||||||
}
|
}
|
||||||
return $winning_bid_num;
|
return $winning_bid_num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class WinningBidderSelectList
|
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')
|
->groupBy('winning_bidder_num')
|
||||||
->orderBy('bidders.bidder_assigned_number')
|
->orderBy('bidders.bidder_assigned_number')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
$winning_bidder_num = '<option disabled selected hidden value="">choose...</option>';
|
$winning_bidder_num = '<option disabled selected hidden value="">choose...</option>';
|
||||||
foreach($winning_bidder_num_results as $winning_bidder_num_result){
|
foreach ($winning_bidder_num_results as $winning_bidder_num_result) {
|
||||||
$winning_bidder_num .= '<option value="' . $winning_bidder_num_result->idbidders . '">' . $winning_bidder_num_result->bidder_assigned_number . ' - ' . $winning_bidder_num_result->bidder_fname . ' ' . $winning_bidder_num_result->bidder_lname .'</option>';
|
$winning_bidder_num .= '<option value="' . $winning_bidder_num_result->idbidders . '">' . $winning_bidder_num_result->bidder_assigned_number . ' - ' . $winning_bidder_num_result->bidder_fname . ' ' . $winning_bidder_num_result->bidder_lname .'</option>';
|
||||||
}
|
}
|
||||||
return $winning_bidder_num;
|
return $winning_bidder_num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user