當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。