silent-auction/app/Helpers/VehicleSelectList.php

34 lines
1.0 KiB
PHP
Raw Permalink Normal View History

2019-07-11 20:55:45 -04:00
<?php
namespace App\Helpers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Models\Bidders;
use App\Models\Vehicles;
class VehicleSelectList
{
public static function vehicleShowNumbers()
{
$bidder_num_results = Bidders::has('vehicles')
->join('vehicles', 'vehicles.owner', '=', 'bidders.bidder_assigned_number')
->orderBy('bidder_assigned_number')
->get();
//dd($bidder_num_results);
$bidder_num = '<option disabled selected hidden value="">choose...</option>';
foreach ($bidder_num_results as $bidder_num_result) {
$bidder_num .= '<option value="' .
$bidder_num_result->id .
'">' .
$bidder_num_result->bidder_assigned_number .
' - ' .
$bidder_num_result->year .
' ' .
$bidder_num_result->make .
'</option>';
}
return $bidder_num;
}
}