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


PHP Mobile::isTablet方法代码示例

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


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

示例1: add_order

 /**
  * @param $customer_id
  * @param $total
  * @return mixed
  */
 public function add_order($customer_id, $delivery_id, $total)
 {
     $detect = new Mobile();
     $device_type = $detect->isMobile() ? $detect->isTablet() ? 'tablet' : 'phone' : 'computer';
     $np_city_ref = Arr::get($_POST, 'np_city_ref');
     $np_address_ref = Arr::get($_POST, 'np_address_ref');
     $city = Arr::get($_POST, 'city');
     $address = Arr::get($_POST, 'address');
     if ($delivery_id = 1) {
         $obj_city = ORM::factory('Novaposhta_City', ['Ref' => $np_city_ref]);
         if ($obj_city->loaded()) {
             $city = $obj_city->DescriptionRu;
         }
         $obj_warehouse = ORM::factory('Novaposhta_Warehouse', ['Ref' => $np_address_ref]);
         if ($obj_warehouse->loaded()) {
             $address = $obj_warehouse->DescriptionRu;
         }
     }
     $obj_order = ORM::factory('Shop_Order');
     $obj_order->customer_id = $customer_id;
     $obj_order->delivery_id = $delivery_id;
     $obj_order->total = $total;
     $obj_order->checked = 0;
     $obj_order->device_type = $device_type;
     $obj_order->oblast = Arr::get($_POST, 'oblast');
     $obj_order->region = Arr::get($_POST, 'region');
     $obj_order->city = $city;
     $obj_order->address = $address;
     $obj_order->np_city_ref = $np_city_ref;
     $obj_order->np_address_ref = $np_address_ref;
     $obj_order->postcode = Arr::get($_POST, 'postcode');
     $obj_order->save();
     $obj_order->number = $obj_order->id . Text::random('nozero', 4);
     $obj_order->save();
     return $obj_order->id;
 }
开发者ID:eok8177,项目名称:shopCMS,代码行数:41,代码来源:Order.php


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