Merge branch 'convert-models' of tfmm/Silent-Auction into master
This commit is contained in:
commit
bd9b7f7956
28
app/Helpers/BidderSelectList.php
Normal file
28
app/Helpers/BidderSelectList.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
namespace App\Helpers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\Bidders;
|
||||
|
||||
class BidderSelectList
|
||||
{
|
||||
public static function bidderShowNumbers()
|
||||
{
|
||||
$bidder_num_results = Bidders::orderBy('bidder_assigned_number')
|
||||
->get();
|
||||
$bidder_num = '<option disabled selected hidden value="">choose...</option>';
|
||||
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>';
|
||||
}
|
||||
return $bidder_num;
|
||||
}
|
||||
}
|
30
app/Helpers/CheckoutBidderSelectList.php
Normal file
30
app/Helpers/CheckoutBidderSelectList.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace App\Helpers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\Checkout;
|
||||
|
||||
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 = '<option disabled selected hidden value="">choose...</option>';
|
||||
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>';
|
||||
}
|
||||
return $checkout_bidder_num;
|
||||
}
|
||||
}
|
24
app/Helpers/ItemSelectList.php
Normal file
24
app/Helpers/ItemSelectList.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace App\Helpers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\Items;
|
||||
|
||||
class ItemSelectList
|
||||
{
|
||||
public static function itemShowNumbers()
|
||||
{
|
||||
$item_num_results = Items::orderBy('item_assigned_num')
|
||||
->get();
|
||||
$item_nums = '<option disabled="disabled" selected="selected" value="0">choose...</option>';
|
||||
foreach ($item_num_results as $item_num_result) {
|
||||
$item_nums .= '<option value="' .
|
||||
$item_num_result->iditems .
|
||||
'">' .
|
||||
$item_num_result->item_assigned_num .
|
||||
'</option>';
|
||||
}
|
||||
return $item_nums;
|
||||
}
|
||||
}
|
28
app/Helpers/PaymentMethodSelectList.php
Normal file
28
app/Helpers/PaymentMethodSelectList.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
namespace App\Helpers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\Bidders;
|
||||
use App\Models\Items;
|
||||
use App\Models\Checkout;
|
||||
use App\Models\PaymentMethods;
|
||||
use App\Models\WinningBids;
|
||||
|
||||
class PaymentMethodSelectList
|
||||
{
|
||||
public static function paymentShowMethods()
|
||||
{
|
||||
$payment_method_results = PaymentMethods::orderBy('pm_name')
|
||||
->get();
|
||||
$payment_methods = '<option disabled="disabled" selected="selected" value="0">choose...</option>';
|
||||
foreach ($payment_method_results as $payment_method_result) {
|
||||
$payment_methods .= '<option value="' .
|
||||
$payment_method_result->pm_id .
|
||||
'">' .
|
||||
$payment_method_result->pm_name .
|
||||
'</option>';
|
||||
}
|
||||
return $payment_methods;
|
||||
}
|
||||
}
|
31
app/Helpers/WinningBidSelectList.php
Normal file
31
app/Helpers/WinningBidSelectList.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
namespace App\Helpers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\Bidders;
|
||||
use App\Models\Items;
|
||||
use App\Models\Checkout;
|
||||
use App\Models\PaymentMethods;
|
||||
use App\Models\WinningBids;
|
||||
|
||||
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 = '<option disabled selected hidden value="">choose...</option>';
|
||||
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>';
|
||||
}
|
||||
return $winning_bid_num;
|
||||
}
|
||||
}
|
41
app/Helpers/WinningBidderSelectList.php
Normal file
41
app/Helpers/WinningBidderSelectList.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace App\Helpers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\Bidders;
|
||||
use App\Models\Items;
|
||||
use App\Models\Checkout;
|
||||
use App\Models\PaymentMethods;
|
||||
use App\Models\WinningBids;
|
||||
|
||||
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 = '<option disabled selected hidden value="">choose...</option>';
|
||||
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>';
|
||||
}
|
||||
return $winning_bidder_num;
|
||||
}
|
||||
}
|
@ -5,36 +5,34 @@ 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]);
|
||||
$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 = 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]);
|
||||
}
|
||||
|
||||
@ -52,7 +50,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 ,
|
||||
@ -61,9 +62,10 @@ 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');
|
||||
}
|
||||
|
||||
@ -90,7 +92,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;
|
||||
@ -125,21 +130,23 @@ 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.*,
|
||||
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.bidder_assigned_number', 'asc')
|
||||
->get();
|
||||
return view('checkout_complete_list', ['checkout_complete_results' => $checkout_complete_results]);
|
||||
}
|
||||
|
||||
@ -151,8 +158,7 @@ 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)
|
||||
$winner_insert = WinningBids::where('idwinning_bids', $winning_bid_id)
|
||||
->update(
|
||||
[
|
||||
'winning_bidder_num' => $winner_bidder,
|
||||
@ -179,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]);
|
||||
}
|
||||
|
||||
@ -202,19 +205,17 @@ class PagesController extends Controller
|
||||
'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_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
|
||||
@ -232,50 +233,32 @@ 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)
|
||||
public function reprintReceipt(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_result = Checkout::where('bidder_num', '=', $bidnum)
|
||||
->first();
|
||||
return redirect()->route('receiptpdf', ['checkout_id' => $checkout_result->checkout_id]);
|
||||
}
|
||||
}
|
||||
|
||||
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]);
|
||||
}
|
||||
|
||||
@ -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
|
||||
");
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
38
app/Models/Bidders.php
Normal file
38
app/Models/Bidders.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Bidders extends Model
|
||||
{
|
||||
protected $table = 'bidders';
|
||||
protected $fillable = [
|
||||
'bidder_fname',
|
||||
'bidder_lname',
|
||||
'bidder_addr',
|
||||
'bidder_city',
|
||||
'bidder_state',
|
||||
'bidder_zip',
|
||||
'bidder_phone',
|
||||
'bidder_email',
|
||||
'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');
|
||||
}
|
||||
|
||||
public function winningBids()
|
||||
{
|
||||
return $this->hasMany('App\Models\WinningBids', 'winning_bidder_num', 'idbidders');
|
||||
}
|
||||
}
|
35
app/Models/Checkout.php
Normal file
35
app/Models/Checkout.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Checkout extends Model
|
||||
{
|
||||
protected $table = 'checkout';
|
||||
protected $fillable = [
|
||||
'bidder_num',
|
||||
'winnertotal',
|
||||
'payment_method',
|
||||
'check_number',
|
||||
'cc_transaction',
|
||||
'cc_amount',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
28
app/Models/Items.php
Normal file
28
app/Models/Items.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Items extends Model
|
||||
{
|
||||
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'
|
||||
];
|
||||
|
||||
public function winningBids()
|
||||
{
|
||||
return $this->belongsTo('App\Models\WinningBids', 'iditems', 'winning_item_num');
|
||||
}
|
||||
}
|
25
app/Models/PaymentMethods.php
Normal file
25
app/Models/PaymentMethods.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PaymentMethods extends Model
|
||||
{
|
||||
protected $table = 'payment_methods';
|
||||
protected $fillable = [
|
||||
'pm_name',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
|
||||
public function checkout()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Checkout', 'payment_method', 'pm_id');
|
||||
}
|
||||
}
|
32
app/Models/WinningBids.php
Normal file
32
app/Models/WinningBids.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class WinningBids extends Model
|
||||
{
|
||||
protected $table = 'winning_bids';
|
||||
protected $fillable = [
|
||||
'winning_bidder_num',
|
||||
'winning_cost',
|
||||
'winning_item_num',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
|
||||
public function items()
|
||||
{
|
||||
return $this->hasMany('App\Models\Items', 'iditems', 'winning_item_num');
|
||||
}
|
||||
|
||||
public function bidders()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Bidders', 'winning_bidder_num', 'idbidders');
|
||||
}
|
||||
}
|
115
app/helpers.php
115
app/helpers.php
@ -1,115 +0,0 @@
|
||||
<?php
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class BidderSelectList
|
||||
{
|
||||
public static function BidderShowNumbers()
|
||||
{
|
||||
$bidder_num_results = DB::select("SELECT
|
||||
*
|
||||
FROM bidders
|
||||
ORDER BY bidder_assigned_number
|
||||
");
|
||||
$bidder_num = '<option disabled selected hidden value="">choose...</option>';
|
||||
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>';
|
||||
}
|
||||
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 = '<option disabled selected hidden value="">choose...</option>';
|
||||
foreach($checkout_bidder_num_results as $checkout_bidder_num_result){
|
||||
$checkout_bidder_num .= '<option value="' . $checkout_bidder_num_result->idbidders . '">' . $checkout_bidder_num_result->bidder_assigned_number . ' - ' . $checkout_bidder_num_result->bidder_fname . ' ' . $checkout_bidder_num_result->bidder_lname .'</option>';
|
||||
}
|
||||
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 = '<option disabled="disabled" selected="selected" value="0">choose...</option>';
|
||||
foreach($item_num_results as $item_num_result){
|
||||
$item_nums .= '<option value="' . $item_num_result->iditems . '">' . $item_num_result->item_assigned_num . '</option>';
|
||||
}
|
||||
return $item_nums;
|
||||
}
|
||||
}
|
||||
class PaymentMethodSelectList
|
||||
{
|
||||
public static function PaymentShowMethods()
|
||||
{
|
||||
$payment_method_results = DB::select("SELECT
|
||||
*
|
||||
FROM payment_methods
|
||||
ORDER BY pm_name
|
||||
");
|
||||
$payment_methods = '<option disabled="disabled" selected="selected" value="0">choose...</option>';
|
||||
foreach($payment_method_results as $payment_method_result){
|
||||
$payment_methods .= '<option value="' . $payment_method_result->pm_id . '">' . $payment_method_result->pm_name . '</option>';
|
||||
}
|
||||
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 = '<option disabled selected hidden value="">choose...</option>';
|
||||
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>';
|
||||
}
|
||||
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 = '<option disabled selected hidden value="">choose...</option>';
|
||||
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>';
|
||||
}
|
||||
return $winning_bidder_num;
|
||||
}
|
||||
}
|
||||
?>
|
@ -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"
|
||||
]
|
||||
|
||||
},
|
||||
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddTimestampsBidders extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('bidders', function ($table) {
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddTimestampsCheckout extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('checkout', function ($table) {
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddTimestampsItems extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('items', function ($table) {
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddTimestampsWinningbids extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('winning_bids', function ($table) {
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddTimestampsPaymentmethods extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('payment_methods', function ($table) {
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -84,7 +84,7 @@
|
||||
</label>
|
||||
<div class=col-sm-4>
|
||||
<select name="checkout_payment_method" id="checkout_payment_method" required class=form-control>
|
||||
<?php echo App\PaymentMethodSelectList::PaymentShowMethods(); ?>
|
||||
<?php echo App\Helpers\PaymentMethodSelectList::PaymentShowMethods(); ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -16,7 +16,7 @@
|
||||
</label>
|
||||
<div class=col-sm-4>
|
||||
<select name="checkoutbiddernum" id="checkoutbiddernum" required class=form-control>
|
||||
<?php echo App\WinningBidderSelectList::WinningBidderShowNumbers(); ?>
|
||||
<?php echo App\Helpers\WinningBidderSelectList::winningBidderShowNumbers(); ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -15,7 +15,7 @@
|
||||
</label>
|
||||
<div class=col-sm-2>
|
||||
<select name="winid" id="winid" required class=form-control>
|
||||
<?php echo App\WinningBidSelectList::WinningBidShowNumbers(); ?>
|
||||
<?php echo App\Helpers\WinningBidSelectList::winningBidShowNumbers(); ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -25,7 +25,7 @@
|
||||
</label>
|
||||
<div class=col-sm-2>
|
||||
<select name="winnerbiddernum" id="winnerbiddernum" required class=form-control>
|
||||
<?php echo App\BidderSelectList::BidderShowNumbers(); ?>
|
||||
<?php echo App\Helpers\BidderSelectList::bidderShowNumbers(); ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -25,19 +25,13 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
@foreach($item_count_result as $item_count_result)
|
||||
{{ $item_count_result->item_count }}
|
||||
@endforeach
|
||||
{{ $item_count_result }}
|
||||
</td>
|
||||
<td>
|
||||
@foreach($bidder_count_result as $bidder_count_result)
|
||||
{{ $bidder_count_result->bidder_count }}
|
||||
@endforeach
|
||||
{{ $bidder_count_result }}
|
||||
</td>
|
||||
<td>
|
||||
@foreach($winner_count_result as $winner_count_result)
|
||||
{{ $winner_count_result->winner_count }}
|
||||
@endforeach
|
||||
{{ $winner_count_result }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -108,21 +108,19 @@
|
||||
</h4>
|
||||
</th>
|
||||
<th>
|
||||
@foreach($checkout_final_results as $checkout_final_result)
|
||||
@if($checkout_final_result->payment_method==1)
|
||||
@if($checkout_final_results->payment_method==1)
|
||||
<h4>
|
||||
CASH
|
||||
</h4>
|
||||
@elseif($checkout_final_result->payment_method==2)
|
||||
@elseif($checkout_final_results->payment_method==2)
|
||||
<h4>
|
||||
CHECK Number {{ $checkout_final_result->check_number }}
|
||||
CHECK Number {{ $checkout_final_results->check_number }}
|
||||
</h4>
|
||||
@else
|
||||
<h4>
|
||||
CREDIT {{ $checkout_final_result->cc_transaction }}
|
||||
CREDIT {{ $checkout_final_results->cc_transaction }}
|
||||
</h4>
|
||||
@endif
|
||||
@endforeach
|
||||
</th>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -16,7 +16,7 @@
|
||||
</label>
|
||||
<div class=col-sm-4>
|
||||
<select name="reprintbiddernum" id="checkoutbiddernum" required class=form-control>
|
||||
<?php echo App\CheckoutBidderSelectList::CheckoutBidderShowNumbers(); ?>
|
||||
<?php echo App\Helpers\CheckoutBidderSelectList::checkoutBidderShowNumbers(); ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
foreach($winnerlist_results as $winnerlist_result){
|
||||
|
||||
echo "<td>" . $winnerlist_result->winning_bidder_num . "</td>";
|
||||
echo "<td>" . $winnerlist_result->bidders->bidder_assigned_number . "</td>";
|
||||
|
||||
// do we need a new row?
|
||||
if($i % 6 === 0){
|
||||
|
@ -16,7 +16,7 @@
|
||||
</label>
|
||||
<div class=col-sm-2>
|
||||
<select name="winneritemnum" id="winneritemnum" required class=form-control>
|
||||
<?php echo App\ItemSelectList::ItemShowNumbers(); ?>
|
||||
<?php echo App\Helpers\ItemSelectList::itemShowNumbers(); ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -26,7 +26,7 @@
|
||||
</label>
|
||||
<div class=col-sm-2>
|
||||
<select name="winnerbiddernum" id="winnerbiddernum" required class=form-control>
|
||||
<?php echo App\BidderSelectList::BidderShowNumbers(); ?>
|
||||
<?php echo App\Helpers\BidderSelectList::bidderShowNumbers(); ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -16,7 +16,7 @@
|
||||
</label>
|
||||
<div class=col-sm-4>
|
||||
<select name="winnerbiddernum" id="winnerbiddernum" required class=form-control>
|
||||
<?php echo App\BidderSelectList::BidderShowNumbers(); ?>
|
||||
<?php echo App\Helpers\BidderSelectList::bidderShowNumbers(); ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -17,7 +17,7 @@
|
||||
// start first row
|
||||
echo "<tr>";
|
||||
foreach($winnerlist_results as $winnerlist_result){
|
||||
echo "<td><h3>" . $winnerlist_result->winning_bidder_num . "</h3></td>";
|
||||
echo "<td><h3>" . $winnerlist_result->bidders->bidder_assigned_number . "</h3></td>";
|
||||
// do we need a new row?
|
||||
if($i % 8 === 0){
|
||||
echo "</tr><tr>";
|
||||
|
@ -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']);
|
||||
|
Loading…
Reference in New Issue
Block a user