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


PHP ParseQuery::first方法代码示例

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


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

示例1: auth

 /**
  * Handles authentication via estonian id-card. Saves data into model User.
  */
 public function auth()
 {
     $ePerson = getEPerson();
     if (!$ePerson) {
         //             TODO: Better handling
         $this->user->string = "ID kaardiga autentimine ebaõnnestus!";
     } else {
         $this->user->lastName = $ePerson[0];
         $this->user->firstName = $ePerson[1];
         $this->user->nationalID = $ePerson[2];
         $this->user->string = "ID kaardiga autentimine õnnestus edukalt!";
         // Check if UserObject already exists
         // TODO: Put following code into separate function
         $query = new ParseQuery("UserObject");
         $query->equalTo("nationalID", $this->user->nationalID);
         $count = $query->count();
         $parseUser = $query->first();
         if ($count == 1 && $parseUser->get('nationalID') == $this->user->nationalID) {
             $this->user->parseMessage = $parseUser->getObjectId();
         } else {
             $this->saveUserData($this->user, $this->user->lastName, $this->user->firstName, $this->user->nationalID);
         }
         // Starts user session
         $this->begin_session();
         //            $this->signUp($this->user, $this->user->lastName, $this->user->firstName, $this->user->nationalID);
     }
 }
开发者ID:aglo35,项目名称:vr_beta,代码行数:30,代码来源:Controller.php

示例2: addTask

 public function addTask(Request $request)
 {
     $parseTask = new ParseObject("Task");
     $parseCropQuery = new ParseQuery("Crop");
     $parseCropQuery->equalTo("cropName", $request->input('crop'));
     $crop = $parseCropQuery->first();
     $parseQuery = new ParseQuery("Task");
     $parseQuery->equalTo("cropName", $crop);
     $parseQuery->equalTo("taskDesc", $request->input('taskName'));
     if ($parseQuery->count() > 0) {
         return redirect('/tasks');
     }
     $parseTask->set("cropName", $crop);
     $parseTask->set("taskDesc", $request->input('taskName'));
     $parseTask->set("taskDuration", $request->input('taskDuration'));
     $parseTask->set("taskStart", $request->input('taskStart'));
     try {
         $parseTask->save();
         \Session::put('message', 1);
         return redirect('tasks');
     } catch (ParseException $e) {
         \Session::put('message', -1);
         return redirect('tasks');
     }
 }
开发者ID:whizdummy,项目名称:Farmers-Plaza-Web,代码行数:25,代码来源:TasksController.php

示例3: __construct

 public function __construct($objectId = null)
 {
     parent::__construct("Camera", $objectId, false);
     $query = new ParseQuery("Camera");
     $query->equalTo("objectId", $objectId);
     $this->_cam = $query->first();
 }
开发者ID:GerardoDRM,项目名称:BondzuWebApp,代码行数:7,代码来源:Camera.php

示例4: __construct

 public function __construct($objectId = null)
 {
     parent::__construct("AnimalV2", $objectId, false);
     $query = new ParseQuery("AnimalV2");
     $query->equalTo("objectId", $objectId);
     $this->_animal = $query->first();
 }
开发者ID:GerardoDRM,项目名称:BondzuWebApp,代码行数:7,代码来源:Animal.php

示例5: getById

 public function getById($objectId)
 {
     $query = new ParseQuery($this->getClassName());
     $query->equalTo('objectId', $objectId);
     $results = $query->first();
     return $results;
 }
开发者ID:EpykOS,项目名称:eelh,代码行数:7,代码来源:BaseRepository.php

示例6: findBy

 /**
  * @param       $field
  * @param       $value
  * @param array $columns
  * @param array $keyToInclude
  *
  * @return ParseObject
  */
 public function findBy($field, $value, $columns = ['*'], $keyToInclude = [])
 {
     $this->query->equalTo($field, $value);
     for ($i = 0; $i < count($keyToInclude); $i++) {
         $this->query->includeKey($keyToInclude[$i]);
     }
     return $this->query->first($this->useMasterKey);
 }
开发者ID:khangaikh,项目名称:golocal,代码行数:16,代码来源:AbstractParseRepository.php

示例7: retrieveByCredentials

 /**
  * Retrieve a user by the given credentials.
  *
  * @param  array $credentials
  *
  * @return \Illuminate\Contracts\Auth\Authenticatable|\LaraParse\Subclasses\User|null
  * @throws \Exception
  * @throws \Parse\ParseException
  */
 public function retrieveByCredentials(array $credentials)
 {
     $username = $this->getUsernameFromCredentials($credentials);
     $query = new ParseQuery('_User');
     $query->equalTo('username', $username);
     $user = $query->first(true);
     return empty($user) ? null : $user;
 }
开发者ID:khangaikh,项目名称:golocal,代码行数:17,代码来源:ParseUserProvider.php

示例8: first

 /**
  * Get the first record that matches the query.
  *
  * @param mixed $selectKeys
  *
  * @return ObjectModel|null
  */
 public function first($selectKeys = null)
 {
     if ($selectKeys) {
         $this->parseQuery->select($selectKeys);
     }
     $data = $this->parseQuery->first($this->useMasterKey);
     if ($data) {
         return $this->createModel($data);
     }
 }
开发者ID:parziphal,项目名称:parse,代码行数:17,代码来源:Query.php

示例9: enviarAtualizacao

 /**
  * Envia push de atualizaçao.
  *
  * @return Response
  */
 public function enviarAtualizacao()
 {
     try {
         ParseClient::initialize('YZzX02HIZ0xnl2XgzYRHB9QRwYr6FBgWrDUYl5w0', 'zNGQwg11i4fQRhGUCZIR777A8VRWjCqe3BQeZgDI', '4neCCcchvafqvgZlnVu0c4q3s3nsmh9n5tYV0x2o');
         $session = Cache::get('sessionToken', 'default');
         $usuario = ParseUser::become($session);
         $texto = Input::get('texto');
         $atualizacaoQuery = new ParseQuery("Atualizacao");
         $atualizacaoQuery->descending("numero");
         $ultimaAtualizacao = $atualizacaoQuery->first();
         $novoNumero = $ultimaAtualizacao->get('numero') + 1;
         $novaAtualizacao = new ParseObject("Atualizacao");
         $novaAtualizacao->set('numero', $novoNumero);
         $novaAtualizacao->set('usuario', $usuario);
         $novaAtualizacao->set('texto', $texto);
         $novaAtualizacao->save();
         // $fields = array('Accept'=>'application/json',
         //          'X-Parse-Application-Id' => 'YZzX02HIZ0xnl2XgzYRHB9QRwYr6FBgWrDUYl5w0',
         //          'X-Parse-Master-Key' => '4neCCcchvafqvgZlnVu0c4q3s3nsmh9n5tYV0x2o');
         // $ch = curl_init();
         // curl_setopt($ch, CURLOPT_URL, 'https://api.parse.com/1/jobs/jobTeste');
         // curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
         // curl_setopt($ch, CURLOPT_HEADER, $fields);
         // curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
         // // curl_setopt(CURLOPT_USERPWD, 'XXXXXX');
         // $result = curl_exec($ch);
         // curl_close($ch);
         // $cmd='curl -X POST \
         // 	  -H \"X-Parse-Application-Id: YZzX02HIZ0xnl2XgzYRHB9QRwYr6FBgWrDUYl5w0\" \
         // 	  -H \"X-Parse-Master-Key: 4neCCcchvafqvgZlnVu0c4q3s3nsmh9n5tYV0x2o\" \
         // 	  -H \"Content-Type: application/json\" \
         // 	  -d \"{\"plan\":\"paid\"}\" \
         // 	  https://api.parse.com/1/jobs/jobTeste';
         // Log::info($cmd);
         // exec($cmd,$result);
         Log::info("CHEGUEI NEGAO");
         // Log::info($result);
         return 200;
     } catch (ParseException $error) {
         return $error;
     }
 }
开发者ID:pietrodegrazia,项目名称:regulaSUSWeb,代码行数:47,代码来源:PushController.php

示例10: firstQuery

 public function firstQuery()
 {
     $query = new ParseQuery("Test");
     try {
         ParseClient::$THROW_RESPONSE = true;
         $results = $query->first();
     } catch (\Exception $ex) {
         $msg = json_decode($ex->getMessage(), true);
         return $msg ? $msg : $ex->getMessage();
     }
 }
开发者ID:nidalb,项目名称:baas,代码行数:11,代码来源:ExampleTest.php

示例11: testIncludeMultipleKeys

 public function testIncludeMultipleKeys()
 {
     Helper::clearClass("Foo");
     Helper::clearClass("Bar");
     Helper::clearClass("Parent");
     $foo = ParseObject::create('Foo');
     $foo->set('rev', 'oof');
     $foo->save();
     $bar = ParseObject::create('Bar');
     $bar->set('rev', 'rab');
     $bar->save();
     $parent = ParseObject::create('Parent');
     $parent->set('foofoo', $foo);
     $parent->set('barbar', $bar);
     $parent->save();
     $query = new ParseQuery('Parent');
     $query->includeKey(['foofoo', 'barbar']);
     $result = $query->first();
     $this->assertEquals('oof', $result->get('foofoo')->get('rev'), 'Object should be fetched');
     $this->assertEquals('rab', $result->get('barbar')->get('rev'), 'Object should be fetched');
 }
开发者ID:rvdavid,项目名称:parse-php-sdk,代码行数:21,代码来源:ParseQueryTest.php

示例12: ParseSessionStorage

require 'vendor/autoload.php';
use Parse\ParseClient;
use Parse\ParseUser;
use Parse\ParseSessionStorage;
use Parse\ParseQuery;
use Parse\ParseObject;
ParseClient::initialize('bYE5q8xvJEiV2A2mtf0fgbQR8olNMQ2wfr05WYco', 'wZ5XfUCgQBZzFfQOwhWzP14W1fHfe6aj4qS76u0h', '3e8xtmuzrlpgAHNq7ho5Pe5tL9HrQFEgtJD2YVvQ');
if (session_status() == PHP_SESSION_NONE) {
    session_start();
}
ParseClient::setStorage(new ParseSessionStorage());
$currentUser = ParseUser::getCurrentUser();
$courseTitle = $_POST["course"];
$classNumber = $_POST["classNumber"];
$courseQuery = new ParseQuery("Course");
$courseQuery->equalTo("Title", $courseTitle);
$course = $courseQuery->first();
$classQuery = new ParseQuery("Class");
$classQuery->equalTo("Course", $course);
$classQuery->equalTo("ClassNumber", intval($classNumber));
$class = $classQuery->first();
$comment = new ParseObject("Comment");
$comment->set("User", $currentUser);
$currentUser->fetch();
$username = $currentUser->get("UserName");
$comment->set("UserName", $username);
$comment->set("Course", $course);
$comment->set("Class", $class);
$comment->set("Text", $_POST["comment"]);
$comment->save();
开发者ID:TiagoRechau,项目名称:E-learning-for-elderly,代码行数:30,代码来源:comment.php

示例13: pageExists

 private function pageExists($name)
 {
     $query = new ParseQuery('Pages');
     $query->equalTo('name', $name);
     $object = $query->first();
     if (is_object($object)) {
         return true;
     }
     return false;
 }
开发者ID:robinraintama,项目名称:parse-php-cms,代码行数:10,代码来源:Cms.php

示例14: ParseSessionStorage

<?php

require 'vendor/autoload.php';
use Parse\ParseClient;
use Parse\ParseUser;
use Parse\ParseSessionStorage;
use Parse\ParseQuery;
use Parse\ParseObject;
ParseClient::initialize('bYE5q8xvJEiV2A2mtf0fgbQR8olNMQ2wfr05WYco', 'wZ5XfUCgQBZzFfQOwhWzP14W1fHfe6aj4qS76u0h', '3e8xtmuzrlpgAHNq7ho5Pe5tL9HrQFEgtJD2YVvQ');
session_start();
$emailfriend = $_GET["friendEmail"];
ParseClient::setStorage(new ParseSessionStorage());
$currentUser = ParseUser::getCurrentUser();
$emailuser = $currentUser->getUsername();
$friendRequestQuery = new ParseQuery("Friends");
$friendRequestQuery->equalTo("email1", $emailfriend);
$friendRequestQuery->equalTo("email2", $emailuser);
$request = $friendRequestQuery->first();
$request->set("Aceite", 0);
$request->save();
$friendRequestQuery = new ParseQuery("Friends");
$friendRequestQuery->equalTo("email2", $emailfriend);
$friendRequestQuery->equalTo("email1", $emailuser);
$request = $friendRequestQuery->first();
$request->set("Aceite", 0);
$request->save();
开发者ID:TiagoRechau,项目名称:E-learning-for-elderly,代码行数:26,代码来源:acceptFriend.php

示例15: Response

    }
    $response = new Response();
    $response->id = $ids;
    $response->name = $names;
    $response->avatar = $avatars;
    echo json_encode($response);
}
if ($func == 'get_user_direct') {
    $query = new ParseQuery("_User");
    $query->equalTo('objectId', $_POST['user']);
    $users = $query->first();
    $ids = array();
    $names = array();
    $avatars = array();
    foreach ($users->get('connected') as $user) {
        $query = new ParseQuery("_User");
        $query->equalTo('objectId', $user);
        $conn = $query->first();
        array_push($ids, $conn->getObjectId());
        array_push($names, $conn->get('first'));
        array_push($avatars, $conn->get('avatar'));
    }
    $response = new Response();
    $response->id = $ids;
    $response->name = $names;
    $response->avatar = $avatars;
    echo json_encode($response);
}
?>
     
开发者ID:louk,项目名称:One-Nice-Thing,代码行数:29,代码来源:chat.php


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