silent-auction/app/helpers.php
2018-12-23 09:46:28 -05:00

102 lines
4.3 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;
use App\Models\PaymentMethods;
use App\Models\WinningBids;
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::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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
?>