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


PHP ParseObject::save方法代码示例

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


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

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

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

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

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

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

示例7: save

 public function save($useMasterKey = false)
 {
     if (!$this->getACL()) {
         throw new ParseException("Roles must have an ACL.");
     }
     if (!$this->getName() || !is_string($this->getName())) {
         throw new ParseException("Roles must have a name.");
     }
     return parent::save($useMasterKey);
 }
开发者ID:alex-z82,项目名称:web-friend-smash,代码行数:10,代码来源:ParseRole.php

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

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

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

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

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

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

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

 function add()
 {
     // validators
     $this->form_validation->set_error_delimiters($this->config->item('error_delimeter_left'), $this->config->item('error_delimeter_right'));
     $this->form_validation->set_rules('user_id', lang('reservations input user_id'), 'trim');
     $this->form_validation->set_rules('team_id', lang('reservations input team_id'), 'trim');
     $this->form_validation->set_rules('match_data[date]', lang('reservations input date'), 'required|trim');
     $this->form_validation->set_rules('match_data[time]', lang('reservations input time'), 'required|trim');
     $this->form_validation->set_rules('match_data[duration]', lang('reservations input duration'), 'required|trim|numeric');
     if ($this->form_validation->run() == true) {
         $data = $this->input->post();
         // save the new user
         $reservation = new ParseObject("Reservation");
         $relationOwner = $reservation->getRelation("userId");
         $queryOwner = ParseUser::query();
         $owner = $queryOwner->get("btPTAhtpvo");
         $relationOwner->add($owner);
         $relationStatus = $reservation->getRelation("status");
         $queryStatus = new ParseQuery("ReservationStatus");
         $status = $queryStatus->get("KIzDQVJrAV");
         $relationStatus->add($status);
         $reservation->setAssociativeArray("reservationData", $data['match_data']);
         try {
             $reservation->save();
             $this->session->set_flashdata('message', 'New object created with objectId: ' . $reservation->getObjectId());
             redirect($this->_redirect_url);
         } catch (ParseException $ex) {
             // Execute any logic that should take place if the save fails.
             // error is a ParseException object with an error code and message.
             $this->session->set_flashdata('error', 'Failed to create new object, with error message: ' . $ex->getMessage());
         }
         // return to list and display message
     }
     // setup page header data
     // setup page header data
     $this->set_title(sprintf(lang('reservations title reservations'), $this->settings->site_name));
     $this->set_subtitle(lang('reservations subtitle add_reservation'));
     $data = $this->includes;
     // set content data
     $content_data = array('cancel_url' => $this->_redirect_url, 'user' => null, 'password_required' => true);
     // load views
     $data['content'] = $this->load->view('reservations/form', $content_data, true);
     $this->load->view($this->template, $data);
 }
开发者ID:angeldeejay,项目名称:backend,代码行数:44,代码来源:Reservations.php


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