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


PHP ParseObject::set方法代码示例

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


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

示例1: agregar

 public function agregar()
 {
     $userid = Auth::user()->id;
     $curso = new Curso();
     $curso->nombre = Input::get('nombre');
     $curso->descripcion = Input::get('descripcion');
     //$file = Input::file('image');
     $curso->activo = Input::get('activo');
     $curso->tipo = Input::get('tipo');
     $curso->basefile = "";
     $curso->id_user = 1;
     $curso->save();
     $the_id = $curso->id;
     $curso = Curso::find($the_id);
     $file = Input::file('logo');
     $destinationPath = 'temp/';
     $filename = $userid . "" . $file->getClientOriginalName();
     Input::file('logo')->move($destinationPath, $filename);
     $file = ParseFile::createFromFile($destinationPath . "/" . $filename, $filename);
     $file->save();
     $url = $file->getURL();
     $curso->img = "" . $url;
     $jobApplication = new ParseObject("cursos");
     $jobApplication->set("myid", $the_id);
     $jobApplication->set("img", $file);
     $jobApplication->save();
     $curso->save();
     File::delete($destinationPath . "/" . $filename);
 }
开发者ID:pblquijano,项目名称:Scauti,代码行数:29,代码来源:AdminController.php

示例2: postVideo

 public function postVideo()
 {
     ini_set('max_execution_time', 300);
     $userid = Auth::user()->id;
     $idcurso = Input::get('idcurso');
     $recurso = new Recurso();
     $recurso->nombre = Input::get('nombre');
     $recurso->descripcion = Input::get('descripcion');
     //$file = Input::file('image');
     $recurso->activo = Input::get('activo');
     $recurso->id_user = 1;
     $recurso->id_curso = $idcurso;
     $recurso->save();
     $the_id = $recurso->id;
     $recurso = Recurso::find($the_id);
     $destinationPath = 'temp/';
     $file = Input::file('video');
     $filename = $userid . "" . $file->getClientOriginalName();
     Input::file('video')->move($destinationPath, $filename);
     $file = ParseFile::createFromFile($destinationPath . "/" . $filename, $filename);
     $file->save();
     $url = $file->getURL();
     $recurso->URL = "" . $url;
     $jobApplication = new ParseObject("recursos");
     $jobApplication->set("myid", $the_id);
     $jobApplication->set("res", $file);
     $jobApplication->save();
     $recurso->save();
     File::delete($destinationPath . "/" . $filename);
 }
开发者ID:pblquijano,项目名称:Scauti,代码行数:30,代码来源:AdminVideosController.php

示例3: 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

示例4: newActivityObject

function newActivityObject()
{
    $object = new ParseObject("Activity");
    $object->set("phoneNumber", $_REQUEST['From']);
    $object->set("body", $_REQUEST['Body']);
    $object->set("to", $_REQUEST['To']);
    $object->set("fromCountry", $_REQUEST['FromCountry']);
    $object->set("messageSid", $_REQUEST['MessageSid']);
    $object->save();
}
开发者ID:alexli2000,项目名称:Zote,代码行数:10,代码来源:test.php

示例5: pay

 private function pay($params)
 {
     $sum = $params['sum'];
     $profit = $params['profit'];
     $unitpayId = $params['unitpayId'];
     $account = $params['account'];
     $paymentType = $params['paymentType'];
     $orderSum = $params['orderSum'];
     $date = $params['date'];
     $paymentType = $params['paymentType'];
     $orderCurrency = $params['orderCurrency'];
     // $errorMessage = $params['errorMessage'];
     $unitPay = new ParseObject("UnitPay");
     $unitPay->set('sum', $sum);
     $unitPay->set('profit', $profit);
     $unitPay->set('unitpayId', $unitpayId);
     $unitPay->set('account', $account);
     $unitPay->set('paymentType', $paymentType);
     $unitPay->set('orderSum', $orderSum);
     $unitPay->set('date', $date);
     $unitPay->set('paymentType', $paymentType);
     $unitPay->set('orderCurrency', $orderCurrency);
     // $unitPay->set('errorMessage', $errorMessage);
     try {
         $unitPay->save();
         // $parseId = $unitPay->getObjectId();
         return $this->getResponseSuccess('PAY is successful');
     } catch (ParseException $ex) {
         return $this->getResponseError('pay error');
     }
 }
开发者ID:kicknick,项目名称:unitpay-parse,代码行数:31,代码来源:index2.php

示例6: getStolenBikes

function getStolenBikes()
{
    $query = new ParseQuery("Bikes");
    $query->exists("sessionStartTime");
    $query->limit(1000);
    $results = $query->find();
    $count = count($results);
    $listOfBikes = array();
    $stolenBikes = 0;
    for ($i = 0; $i < $count; $i++) {
        $startDate = $results[$i]->get("sessionStartTime");
        $startDate = $startDate->format('Y-m-d H:i:s');
        $startDate = strtotime($startDate);
        $currentDate = new DateTime('now');
        $currentDate = $currentDate->format('Y-m-d H:i:s');
        $currentDate = strtotime($currentDate);
        $subtractedDate = $currentDate - $startDate;
        $expiredTime = 200 * 60;
        if ($subtractedDate >= $expiredTime * 60) {
            $stolenBikes++;
            $bike = $results[$i];
            try {
                $lostBike = new ParseObject("LostBikes");
                $lostBike->set("bikeId", $bike->getObjectId());
                $user = $bike->get("currentUser");
                $user->fetch();
                $customerID = $user->get("stripeID");
                $amount = 200 * 100;
                $charge = \Stripe\Charge::create(array('customer' => $customerID, 'amount' => $amount, 'currency' => 'usd'));
                $lostBike->set("currentUser", $user);
                $lostBike->set("lastLocation", $bike->get("lastLocation"));
                $lostBike->set("condition", $bike->get("condition"));
                $lostBike->save();
                $bike->destroy();
            } catch (\Parse\ParseException $ex) {
                return 'Failed to create LostBikes object and destroy Bikes object ' . $ex->getMessage();
            } catch (\Stripe\Error\InvalidRequest $e) {
                return $e->getMessage();
            } catch (\Stripe\Error\Authentication $e) {
                return $e->getMessage();
            } catch (\Stripe\Error\ApiConnection $e) {
                return $e->getMessage();
            } catch (\Stripe\Error\Base $e) {
                return $e->getMessage();
            } catch (Exception $e) {
                return $e->getMessage();
            }
        }
    }
    $rString = 0;
    if ($stolenBikes > 0) {
        $rString = "Successfully removed " . $stolenBikes . " stolen bikes.";
    }
    return $rString;
}
开发者ID:es2fq,项目名称:BaasAPI,代码行数:55,代码来源:removeExpiredBikes.php

示例7: store

 public function store(ValidateUploadAttraction $request)
 {
     $attraction = new ParseObject("attractions");
     $attraction->set("name", $request->get('name'));
     $attraction->set("type", $request->get('type'));
     $attraction->set("location", $request->get('location'));
     $attraction->set("description", $request->get('description'));
     $file = $request->file('image');
     // $localFilePath = "/public/images/attractions/Palace.jpg";
     $f = ParseFile::createFromData(file_get_contents($_FILES['image']['tmp_name']), $_FILES['image']['name']);
     $f->save();
     $audio = $request->file('media');
     $m = ParseFile::createFromData(file_get_contents($_FILES['media']['tmp_name']), $_FILES['media']['name']);
     $m->save();
     $attraction->set("image", $f);
     $attraction->set("media", $m);
     $a = $request->get('priority');
     $int = (int) $a;
     $attraction->set("priority", $int);
     $expID = 'wJacAzyx3T';
     $exp = '7YuChBta6I';
     $query = new ParseQuery("experts");
     $expertID = $query->get($expID);
     $query1 = new ParseQuery("Cities");
     $expert = $query1->get($exp);
     $attraction->set("expert", $expertID);
     $attraction->set("city_attractions", $expert);
     $attraction->save();
     return \Redirect::route('uploadAttractions')->with('message', 'Attraction has been created');
 }
开发者ID:aktn,项目名称:Laravel_TripPlan,代码行数:30,代码来源:ExpertController.php

示例8: store

 public function store(ValidateAddExpert $request)
 {
     $expert = new ParseObject("experts");
     $expert->set("name", $request->get('name'));
     $expert->set("email", $request->get('email'));
     $expert->set("password", bcrypt($request->get('password')));
     $cityID = $request->get('city');
     $c = new ParseQuery("Cities");
     $city = $c->get($cityID);
     $expert->set("city", $city);
     $expert->save();
     return \Redirect::route('addExpert')->with('message', 'Expert has been created');
 }
开发者ID:aktn,项目名称:Laravel_TripPlan,代码行数:13,代码来源:AdminController.php

示例9: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update()
 {
     try {
         ParseClient::initialize(env('PARSE_ID', 'fuck'), env('PARSE_REST', 'fuck'), env('PARSE_MASTER', 'fuck'));
         $condicoesJSON = Input::get('condicoes');
         $condicoes = json_decode($condicoesJSON);
         $protocoloId = Input::get('id');
         $protocoloQuery = new ParseQuery("Protocolo");
         $protocolo = $protocoloQuery->get($protocoloId);
         $condQuery = new ParseQuery("DescritivoMinimo");
         $condQuery->equalTo('protocolo', $protocolo);
         $condicoesFromServer = $condQuery->find();
         $condicoesArray = [];
         for ($serverIndex = 0; $serverIndex < count($condicoesFromServer); $serverIndex++) {
             $present = false;
             if (array_key_exists($serverIndex, $condicoesFromServer)) {
                 $keysArray = array_keys($condicoes);
                 for ($localIndex = 0; $localIndex < count($keysArray); $localIndex++) {
                     if (array_key_exists($keysArray[$localIndex], $condicoes)) {
                         if ($condicoes[$keysArray[$localIndex]]->id == $condicoesFromServer[$serverIndex]->getObjectId()) {
                             $present = true;
                             $condicoesFromServer[$serverIndex]->set('ordem', $condicoes[$keysArray[$localIndex]]->ordem);
                             $condicoesFromServer[$serverIndex]->save();
                             $condicoesArray[$condicoes[$keysArray[$localIndex]]->ordem] = $condicoesFromServer[$serverIndex]->getObjectId();
                             unset($condicoes[$keysArray[$localIndex]]);
                         }
                     }
                 }
                 if ($present == false) {
                     $condicoesFromServer[$serverIndex]->destroy();
                 }
             }
         }
         $keysArray = array_keys($condicoes);
         for ($index = 0; $index < count($keysArray); $index++) {
             $condicao = new ParseObject("DescritivoMinimo");
             $condicao->set('frase', $condicoes[$keysArray[$index]]->frase);
             $condicao->set('ordem', $condicoes[$keysArray[$index]]->ordem);
             $condicao->set('protocolo', $protocolo);
             $condicao->save();
             $condicoesArray[$condicoes[$keysArray[$index]]->ordem] = $condicao->getObjectId();
         }
         return json_encode($condicoesArray);
     } catch (ParseException $error) {
         dd($error);
         return $error;
     }
 }
开发者ID:pietrodegrazia,项目名称:regulaSUSWeb,代码行数:54,代码来源:DescritivoController.php

示例10: addAction

 /**
  * Creates a new item and associates it with the current user. Redirects to the app (PRG) and uses the flash message
  * to pass on any errors.
  *
  * @throws \Exception
  */
 public function addAction()
 {
     if (!$this->request instanceof \Zend\Http\Request or !$this->request->isPost()) {
         return;
         //nothing to do
     }
     $item = new ParseObject(self::PARSE_CLASS);
     $item->set('todoItem', $this->request->getPost('item'));
     $item->set('user', $this->user);
     try {
         $item->save();
     } catch (ParseException $e) {
         $this->flashMessenger()->addErrorMessage($e->getMessage());
     }
     $this->redirect()->toRoute('app');
 }
开发者ID:mkhuramj,项目名称:ToDo-Web,代码行数:22,代码来源:AppController.php

示例11: add

 public function add($data)
 {
     $filePath = $data["uploadPhoto"]["tmp_name"];
     $ext = pathinfo($data["uploadPhoto"]["name"], PATHINFO_EXTENSION);
     $file = ParseFile::createFromFile($filePath, $data["username"] . "." . $ext);
     $file->save();
     $url = $file->getUrl();
     $cp = new ParseObject("_User");
     $cp->set("username", $data["username"]);
     $cp->set("password", 'leafblast');
     $cp->set("firstName", $data["firstName"]);
     $cp->set("lastName", $data["lastName"]);
     $cp->set("email", $data["email"]);
     $cp->set("homeAddress", $data["homeAddress"]);
     $cp->set("phoneNumber", $data["phoneNumber"]);
     $cp->set("operatorPicture", $file);
     $cp->set("isOperator", true);
     $cp->set("isRemoved", false);
     $cp->set("isSuspended", true);
     $cp->set("isFirstTime", true);
     $cp->set("isDeactivated", true);
     try {
         $cp->save();
         // die('<pre>'.print_r($cp, true));
         $cu = new ParseObject("UserData");
         $cu->set("user", $cp);
         $cu->save();
         return $cp->getObjectId();
     } catch (ParseException $ex) {
         die('<pre>' . print_r($ex->getMessage(), true));
     }
 }
开发者ID:oscarsmartwave,项目名称:l45fbl45t,代码行数:32,代码来源:Operators_model.php

示例12: testGeoBox

 public function testGeoBox()
 {
     $caltrainStationLocation = new ParseGeoPoint(37.776346, -122.394218);
     $caltrainStation = ParseObject::create('TestObject');
     $caltrainStation->set('location', $caltrainStationLocation);
     $caltrainStation->set('name', 'caltrain');
     $caltrainStation->save();
     $santaClaraLocation = new ParseGeoPoint(37.325635, -121.945753);
     $santaClara = new ParseObject('TestObject');
     $santaClara->set('location', $santaClaraLocation);
     $santaClara->set('name', 'santa clara');
     $santaClara->save();
     $southwestOfSF = new ParseGeoPoint(37.708813, -122.526398);
     $northeastOfSF = new ParseGeoPoint(37.822802, -122.373962);
     // Try a correct query
     $query = new ParseQuery('TestObject');
     $query->withinGeoBox('location', $southwestOfSF, $northeastOfSF);
     $objectsInSF = $query->find();
     $this->assertEquals(1, count($objectsInSF));
     $this->assertEquals('caltrain', $objectsInSF[0]->get('name'));
     // Switch order of args, should fail because it crosses the dateline
     $query = new ParseQuery('TestObject');
     $query->withinGeoBox('location', $northeastOfSF, $southwestOfSF);
     try {
         $results = $query->find();
         $this->assertTrue(false, 'Query should fail because it crosses dateline');
     } catch (ParseException $e) {
     }
     $northwestOfSF = new ParseGeoPoint(37.822802, -122.526398);
     $southeastOfSF = new ParseGeoPoint(37.708813, -122.373962);
     // Switch just longitude, should fail because it crosses the dateline
     $query = new ParseQuery('TestObject');
     $query->withinGeoBox('location', $southeastOfSF, $northwestOfSF);
     try {
         $query->find();
         $this->assertTrue(false, 'Query should fail because it crosses dateline');
     } catch (ParseException $e) {
     }
     // Switch just the latitude, should fail because it doesnt make sense
     $query = new ParseQuery('TestObject');
     $query->withinGeoBox('location', $northwestOfSF, $southeastOfSF);
     try {
         $query->find();
         $this->assertTrue(false, 'Query should fail because it makes no sense');
     } catch (ParseException $e) {
     }
 }
开发者ID:rvdavid,项目名称:parse-php-sdk,代码行数:47,代码来源:ParseGeoBoxTest.php

示例13: Object

 /**
  * ParseObject class is missing a static create() function.
  * We can use ParseHelper::Object($classname) as creator function
  * with optional initialization data.
  *
  * @param string $className
  * @param array $array
  *
  * @return ParseObject
  */
 public static function Object($className, $array = array())
 {
     $object = new ParseObject($className);
     foreach ($array as $k => $v) {
         $object->set($k, $v);
     }
     return $object;
 }
开发者ID:rolandurban,项目名称:parse-php-sdk,代码行数:18,代码来源:ParseHelper.php

示例14: update

 public function update($obj)
 {
     if (empty($obj)) {
         die("No hay asistentes para Actualizar.");
     }
     $con = new Connect();
     $var = $con->connect_to_db();
     $date = new DateTime();
     $resultado = new ParseObject("Asistencia", $obj["IdUsuario"]);
     $resultado->set("Fecha", $date);
     $resultado->set("Presente", $obj["Presente"]);
     try {
         $resultado->save();
         echo 'El objeto fue actualizado: ' . $resultado->getObjectId();
     } catch (ParseException $ex) {
         echo 'Fallo al actualizar, mensaje de error: ' . $ex->getMessage();
     }
 }
开发者ID:vorenusCoA,项目名称:App_Asistencia,代码行数:18,代码来源:UpdateManager.php

示例15: _addTestObjects

 private function _addTestObjects($numberOfObjects = 5)
 {
     $objects = [];
     for ($i = 0; $i < $numberOfObjects; $i++) {
         $object = new ParseObject($this->testParseClassName);
         $object->set('String', 'String' . $i);
         $objects[] = $object;
     }
     ParseObject::saveAll($objects);
 }
开发者ID:funkardotnu,项目名称:cacheableparsequery,代码行数:10,代码来源:CacheableParseQueryTest.php


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