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


PHP Device::find方法代码示例

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


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

示例1: logout

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function logout()
 {
     $input = Input::all();
     $device = Device::where('device_id', $input['device_id'])->where('user_id', $input['user_id'])->first();
     if ($device) {
         if ($device->session_id == $input['session_id']) {
             Device::find($device->id)->update(['session_id' => null]);
             return Common::returnData(200, SUCCESS, $input['user_id'], '');
         } else {
             throw new Prototype\Exceptions\UserSessionErrorException();
         }
     }
     throw new Prototype\Exceptions\DeviceErrorException();
 }
开发者ID:trantung,项目名称:online_market,代码行数:19,代码来源:LogoutController.php

示例2: getSessionId

 public static function getSessionId($input, $userId)
 {
     $device = Device::where('device_id', $input['device_id'])->where('user_id', $userId)->first();
     if ($device) {
         if (empty($input['session_id'])) {
             $sessionId = $device->session_id;
             if (!$sessionId) {
                 $sessionId = generateRandomString();
                 Device::find($device->id)->update(['session_id' => $sessionId]);
             }
         } else {
             if ($device->session_id == $input['session_id']) {
                 $sessionId = $input['session_id'];
             } else {
                 throw new Prototype\Exceptions\UserSessionErrorException();
             }
         }
     } else {
         $sessionId = generateRandomString();
         Device::create(['device_id' => $input['device_id'], 'user_id' => $userId, 'session_id' => $sessionId]);
     }
     return $sessionId;
 }
开发者ID:trantung,项目名称:online_market,代码行数:23,代码来源:Common.php

示例3: parseDevices

 function parseDevices($domainNode, $domainName)
 {
     $i = 0;
     $deviceNodes = $this->xpath->query(".//x:node", $domainNode);
     if ($deviceNodes) {
         foreach ($deviceNodes as $deviceNode) {
             $idString = $deviceNode->getAttribute('id');
             $id = explode("=", $idString);
             $deviceName = $id[count($id) - 1];
             $geo = Device::find()->where(['domain' => $domainName, 'node' => $deviceName])->asArray()->one();
             if (!$geo) {
                 $geo = $this->parseLocation($domainName, $deviceName);
                 Device::createIfNew($domainName, $deviceName, $geo['lat'], $geo['lng'], $geo['address']);
                 $i++;
             }
             $location = $this->xml->createElement('CtrlPlane:location');
             $lat = $this->xml->createElement('CtrlPlane:latitude', $geo['lat']);
             $lng = $this->xml->createElement('CtrlPlane:longitude', $geo['lng']);
             $address = $this->xml->createElement('CtrlPlane:address', $geo['address']);
             $location->appendChild($lat);
             $location->appendChild($lng);
             $location->appendChild($address);
             $deviceNode->appendChild($location);
         }
         if ($i > 3) {
             $i = 0;
             sleep(1);
         }
     }
 }
开发者ID:ufrgs-hyman,项目名称:proxy-agg,代码行数:30,代码来源:NMWGProxy.php

示例4: edit

 public function edit($id)
 {
     $device = Device::find($id);
     return View::make('devices.edit', array('device' => $device, 'status' => $this->status, 'types' => $this->types, 'users' => $this->users, 'region' => $this->region));
 }
开发者ID:BitsokoGH,项目名称:pvlmd-web,代码行数:5,代码来源:UserController.php


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