silent-auction/app/helpers.php

113 lines
4.1 KiB
PHP
Raw Normal View History

2018-06-11 13:43:21 -04:00
<?php
namespace App;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
2018-12-23 09:02:54 -05:00
use App\Models\Bidders;
use App\Models\Items;
2018-12-23 09:09:06 -05:00
use App\Models\Checkout;
2018-06-11 13:43:21 -04:00
class BidderSelectList
{
public static function BidderShowNumbers()
{
2018-12-23 09:02:54 -05:00
$bidder_num_results = Bidders::orderBy('bidder_assigned_number')
->get();
2018-06-11 13:43:21 -04:00
$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()
{
2018-12-23 09:11:53 -05:00
$checkout_bidder_num_results = Checkout::with(['bidders' => function ($q) {
$q->orderBy('bidder_assigned_number', 'asc');
}])
2018-12-23 09:09:06 -05:00
->get();
2018-12-23 09:20:43 -05:00
dd($checkout_bidder_num_results);
2018-06-11 13:43:21 -04:00
$checkout_bidder_num = '<option disabled selected hidden value="">choose...</option>';
2018-12-23 09:20:43 -05:00
foreach($checkout_bidder_num_results as $checkout_bidder_num_result){
2018-12-23 09:17:22 -05:00
$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>';
2018-06-11 13:43:21 -04:00
}
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;
}
}
?>