silent-auction/app/helpers.php

101 lines
4.4 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-12-23 09:37:37 -05:00
use App\Models\PaymentMethods;
2018-12-23 09:42:40 -05:00
use App\Models\WinningBids;
2018-06-11 13:43:21 -04:00
class BidderSelectList
{
2018-12-23 10:26:26 -05:00
public static function BidderShowNumbers()
{
$bidder_num_results = Bidders::orderBy('bidder_assigned_number')
2018-12-23 09:02:54 -05:00
->get();
2018-12-23 10:26:26 -05: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;
2018-06-11 13:43:21 -04:00
}
}
class CheckoutBidderSelectList
{
2018-12-23 10:26:26 -05:00
public static function CheckoutBidderShowNumbers()
{
$checkout_bidder_num_results = Checkout::join('bidders', 'checkout.bidder_num', '=', 'bidders.idbidders')
2018-12-23 09:33:40 -05:00
->orderBy('bidders.bidder_assigned_number', 'asc')
->get();
2018-12-23 10:26:26 -05:00
$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;
2018-06-11 13:43:21 -04:00
}
}
class ItemSelectList
{
2018-12-23 10:26:26 -05:00
public static function ItemShowNumbers()
{
$item_num_results = Items::orderBy('item_assigned_num')
2018-12-23 09:36:03 -05:00
->get();
2018-12-23 10:26:26 -05:00
$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;
2018-06-11 13:43:21 -04:00
}
}
class PaymentMethodSelectList
{
2018-12-23 10:26:26 -05:00
public static function PaymentShowMethods()
{
$payment_method_results = PaymentMethods::orderBy('pm_name')
2018-12-23 09:37:37 -05:00
->get();
2018-12-23 10:26:26 -05:00
$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;
2018-06-11 13:43:21 -04:00
}
}
class WinningBidSelectList
{
2018-12-23 10:26:26 -05:00
public static function WinningBidShowNumbers()
{
$winning_bid_num_results = WinningBids::join('items', 'winning_bids.winning_item_num', '=', 'items.iditems')
2018-12-23 09:41:57 -05:00
->orderBy('items.item_assigned_num')
->get();
2018-12-23 10:26:26 -05:00
$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;
2018-06-11 13:43:21 -04:00
}
}
class WinningBidderSelectList
{
2018-12-23 10:26:26 -05:00
public static function WinningBidderShowNumbers()
{
2018-12-23 09:45:59 -05:00
2018-12-23 10:26:26 -05:00
$winning_bidder_num_results = WinningBids::join('bidders', 'winning_bids.winning_bidder_num', '=', 'bidders.idbidders')
2018-12-23 09:46:28 -05:00
->groupBy('winning_bidder_num')
2018-12-23 09:45:59 -05:00
->orderBy('bidders.bidder_assigned_number')
->get();
2018-12-23 10:26:26 -05:00
$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;
2018-06-11 13:43:21 -04:00
}
}