当前位置: 首页>>代码示例>>PHP>>正文


PHP Countries::where方法代码示例

本文整理汇总了PHP中Countries::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Countries::where方法的具体用法?PHP Countries::where怎么用?PHP Countries::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Countries的用法示例。


在下文中一共展示了Countries::where方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCountry

 public function getCountry($id)
 {
     $country = Countries::where('region_id', '=', $id)->get();
     $html = '<option></option>';
     foreach ($country as $c) {
         $html .= "<option value='" . $c->id . "'>" . $c->name . "</option>";
     }
     echo $html;
 }
开发者ID:andrinda,项目名称:myhotel,代码行数:9,代码来源:GuestController.php

示例2: getIndex

 public function getIndex()
 {
     $hotel = Hotel::find(1);
     $regions = Regions::all();
     $country = Countries::where('region_id', '=', $hotel->city->province->country->region->id)->get();
     $province = Provinces::where('country_id', '=', $hotel->city->province->country->id)->get();
     $city = Cities::where('province_id', '=', $hotel->city->province->id)->get();
     $options = array('hotel' => $hotel, 'regions' => $regions, 'country' => $country, 'province' => $province, 'city' => $city);
     return View::make('home/dashboard', array())->nest('content', 'hotel/profile', $options);
 }
开发者ID:andrinda,项目名称:myhotel,代码行数:10,代码来源:HotelController.php

示例3: loadAddressAttributes

 /**
  * Add country id to attributes array
  *
  * @param  array $attributes
  * @return array $attributes
  * @throws FailedValidationException
  */
 public function loadAddressAttributes(array $attributes)
 {
     // return if no country given
     if (!isset($attributes['country'])) {
         return $attributes;
     }
     // find country
     $country = \Countries::where('iso_3166_2', $attributes['country'])->orWhere('iso_3166_3', $attributes['country'])->first();
     // unset country from attributes array
     unset($attributes['country']);
     // add country_id to attributes array
     if (is_object($country) && isset($country->id)) {
         $attributes['country_id'] = $country->id;
     }
     // run validation
     $validator = $this->validateAddress($attributes);
     if ($validator->fails()) {
         throw new FailedValidationException('Validator failed for: ' . implode(', ', $attributes));
     }
     // return attributes array with country_id key/value pair
     return $attributes;
 }
开发者ID:AlexanderPoellmann,项目名称:laravel-addresses,代码行数:29,代码来源:HasAddresses.php


注:本文中的Countries::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。