本文整理汇总了PHP中app\models\Customer::has方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::has方法的具体用法?PHP Customer::has怎么用?PHP Customer::has使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Customer
的用法示例。
在下文中一共展示了Customer::has方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
if (!$this->hasPermission($this->menuPermissionName)) {
return view($this->viewPermissiondeniedName);
}
$bookingcustomers = Customer::has('bookingCarPreemptions')->orderBy('firstname', 'asc')->orderBy('lastname', 'asc')->get(['id', 'title', 'firstname', 'lastname']);
$bookingcustomerselectlist = array();
foreach ($bookingcustomers as $item) {
array_push($bookingcustomerselectlist, $item->id . ':' . $item->title . ' ' . $item->firstname . ' ' . $item->lastname);
}
$carmodels = CarModel::has('carPreemptions')->orderBy('name', 'asc')->get(['id', 'name']);
$carmodelselectlist = array();
foreach ($carmodels as $item) {
array_push($carmodelselectlist, $item->id . ':' . $item->name);
}
$carsubmodels = CarSubModel::has('carPreemptions')->orderBy('name', 'asc')->get(['id', 'name']);
$carsubmodelselectlist = array();
foreach ($carsubmodels as $item) {
array_push($carsubmodelselectlist, $item->id . ':' . $item->name);
}
$colors = Color::has('carPreemptions')->orderBy('code', 'asc')->get(['id', 'code', 'name']);
$colorselectlist = array();
foreach ($colors as $item) {
array_push($colorselectlist, $item->id . ':' . $item->code . ' - ' . $item->name);
}
$buyercustomers = Customer::has('buyerCarPreemptions')->orderBy('firstname', 'asc')->orderBy('lastname', 'asc')->get(['id', 'title', 'firstname', 'lastname']);
$buyercustomerselectlist = array();
foreach ($buyercustomers as $item) {
array_push($buyercustomerselectlist, $item->id . ':' . $item->title . ' ' . $item->firstname . ' ' . $item->lastname);
}
$salesmanemployees = Employee::has('salesmanCarPreemptions')->orderBy('firstname', 'asc')->orderBy('lastname', 'asc')->get(['id', 'title', 'firstname', 'lastname']);
$salesmanemployeeselectlist = array();
foreach ($salesmanemployees as $item) {
array_push($salesmanemployeeselectlist, $item->id . ':' . $item->title . ' ' . $item->firstname . ' ' . $item->lastname);
}
$salesmanageremployees = Employee::has('salesmanagerCarPreemptions')->orderBy('firstname', 'asc')->orderBy('lastname', 'asc')->get(['id', 'title', 'firstname', 'lastname']);
$salesmanageremployeeselectlist = array();
foreach ($salesmanageremployees as $item) {
array_push($salesmanageremployeeselectlist, $item->id . ':' . $item->title . ' ' . $item->firstname . ' ' . $item->lastname);
}
$approversemployees = Employee::has('approversCarPreemptions')->orderBy('firstname', 'asc')->orderBy('lastname', 'asc')->get(['id', 'title', 'firstname', 'lastname']);
$approversemployeeselectlist = array();
foreach ($approversemployees as $item) {
array_push($approversemployeeselectlist, $item->id . ':' . $item->title . ' ' . $item->firstname . ' ' . $item->lastname);
}
$pricelists = Pricelist::has('carPreemptions')->orderBy('sellingpricewithaccessories', 'asc')->get(['id', 'sellingpricewithaccessories', 'promotion']);
$priceselectlist = array();
foreach ($pricelists as $item) {
//if($item->promotion != null && $item->promotion != '')
//array_push($priceselectlist,$item->id.':'.$item->sellingpricewithaccessories.' ('.$item->promotion.')');
//else
array_push($priceselectlist, $item->id . ':' . $item->sellingpricewithaccessories);
}
return view('carpreemption', ['bookingcustomerselectlist' => implode(";", $bookingcustomerselectlist), 'carmodelselectlist' => implode(";", $carmodelselectlist), 'carsubmodelselectlist' => implode(";", $carsubmodelselectlist), 'colorselectlist' => implode(";", $colorselectlist), 'buyercustomerselectlist' => implode(";", $buyercustomerselectlist), 'salesmanemployeeselectlist' => implode(";", $salesmanemployeeselectlist), 'salesmanageremployeeselectlist' => implode(";", $salesmanageremployeeselectlist), 'approversemployeeselectlist' => implode(";", $approversemployeeselectlist), 'priceselectlist' => implode(";", $priceselectlist)]);
}
示例2: index
public function index()
{
if (!$this->hasPermission($this->menuPermissionName)) {
return view($this->viewPermissiondeniedName);
}
$provinces = Province::whereHas('branchs', function ($q) {
$q->where('isheadquarter', true);
})->orderBy('name', 'asc')->get(['id', 'name']);
$provinceselectlist = array();
array_push($provinceselectlist, ':เลือกจังหวัด');
foreach ($provinces as $item) {
array_push($provinceselectlist, $item->id . ':' . $item->name);
}
if (Auth::user()->isadmin) {
$customers = Customer::has('redLabels')->orderBy('firstname', 'asc')->orderBy('lastname', 'asc')->get(['id', 'title', 'firstname', 'lastname']);
} else {
$customers = Customer::where('provinceid', Auth::user()->provinceid)->has('redLabels')->orderBy('firstname', 'asc')->orderBy('lastname', 'asc')->get(['id', 'title', 'firstname', 'lastname']);
}
$customerselectlist = array();
foreach ($customers as $item) {
array_push($customerselectlist, $item->id . ':' . $item->title . ' ' . $item->firstname . ' ' . $item->lastname);
}
if (Auth::user()->isadmin) {
$cars = Car::has('redLabel')->orderBy('chassisno', 'asc')->orderBy('engineno', 'asc')->get(['id', 'chassisno', 'engineno']);
} else {
$cars = Car::where('provinceid', Auth::user()->provinceid)->has('redLabel')->orderBy('chassisno', 'asc')->orderBy('engineno', 'asc')->get(['id', 'chassisno', 'engineno']);
}
$carselectlist = array();
array_push($carselectlist, ':เลือกรถ');
foreach ($cars as $item) {
array_push($carselectlist, $item->id . ':' . $item->chassisno . '/' . $item->engineno);
}
if (Auth::user()->isadmin) {
$carpreemptions = CarPreemption::has('redlabelhistories')->orderBy('bookno', 'asc')->orderBy('no', 'asc')->get(['id', 'bookno', 'no', 'buyercustomerid', 'salesmanemployeeid']);
} else {
$carpreemptions = CarPreemption::where('provinceid', Auth::user()->provinceid)->has('redlabelhistories')->orderBy('bookno', 'asc')->orderBy('no', 'asc')->get(['id', 'bookno', 'no', 'buyercustomerid', 'salesmanemployeeid']);
}
$carpreemptionselectlist = array();
array_push($carpreemptionselectlist, ':เลือกการจอง');
foreach ($carpreemptions as $item) {
$buyercustomer = Customer::find($item->buyercustomerid);
$buyercustomername = $buyercustomer->title . ' ' . $buyercustomer->firstname . ' ' . $buyercustomer->lastname;
$salesmanemployee = Employee::find($item->salesmanemployeeid);
$salesmanemployeename = $salesmanemployee->title . ' ' . $salesmanemployee->firstname . ' ' . $salesmanemployee->lastname;
array_push($carpreemptionselectlist, $item->id . ':' . str_pad($item->bookno . '/' . $item->no, strlen($item->bookno . '/' . $item->no) + 15, " ") . str_pad($buyercustomername, strlen($buyercustomername) + 15, " ") . $salesmanemployeename);
}
$defaultProvince = '';
if (Auth::user()->isadmin == false) {
$defaultProvince = Auth::user()->provinceid;
}
return view('redlabel', ['provinceselectlist' => implode(";", $provinceselectlist), 'customerselectlist' => implode(";", $customerselectlist), 'carselectlist' => implode(";", $carselectlist), 'carpreemptionselectlist' => implode(";", $carpreemptionselectlist), 'defaultProvince' => $defaultProvince]);
}