silent-auction/app/helpers.php
2018-12-23 09:30:32 -05:00

111 lines
4.1 KiB
PHP

<?php
namespace App;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Models\Bidders;
use App\Models\Items;
use App\Models\Checkout;
class BidderSelectList
{
public static function BidderShowNumbers()
{
$bidder_num_results = 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;
}
}
class CheckoutBidderSelectList
{
public static function CheckoutBidderShowNumbers()
{
$checkout_bidder_num_results = Checkout:://with('bidders')
get();
$checkout_bidder_num_results = $checkout_bidder_num_results->bidders->sortBy('bidder_assigned_number');
$checkout_bidder_num = '<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;
}
}
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;
}
}
?>