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


PHP Parse\ParseObject类代码示例

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


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

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

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

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

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

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

示例6: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     try {
         ParseClient::initialize(env('PARSE_ID', 'fuck'), env('PARSE_REST', 'fuck'), env('PARSE_MASTER', 'fuck'));
         $data = Input::file('file');
         $path = $data->getRealPath();
         $mime = $data->getMimeType();
         $nomeOriginal = $data->getClientOriginalName();
         $nomeCorrigido = preg_replace('/\\s+/', '', $nomeOriginal);
         $file = ParseFile::createFromFile($path, $nomeCorrigido, $mime);
         $file->save();
         $nome = Input::get('nome');
         $especialidadeId = Input::get('especialidadeId');
         $especQuery = new ParseQuery("Especialidade");
         $especialidade = $especQuery->get($especialidadeId);
         $anexo = ParseObject::create("Anexo");
         $anexo->set('conteudo', $file);
         $anexo->set('nome', $nome);
         $anexo->set('especialidade', $especialidade);
         $anexo->save();
         return json_encode(['url' => $anexo->get('conteudo')->getURL(), 'Id' => $anexo->getObjectId()]);
     } catch (ParseException $error) {
         return $error;
     }
 }
开发者ID:pietrodegrazia,项目名称:regulaSUSWeb,代码行数:30,代码来源:AnexoController.php

示例7: purchase

 public function purchase()
 {
     $input = Input::all();
     $mailEmail = strpos($input['stripeEmail'], "mail.mcgill.ca");
     //send back if not a validStripe Token
     if (empty($input['stripeToken'])) {
         return Redirect::back();
     }
     //Charge Customer
     $charge = Stripe::charges()->create(['source' => $input['stripeToken'], 'receipt_email' => $input['stripeEmail'], 'currency' => 'CAD', 'amount' => env($input['sponsor'] . "_PRICE")]);
     //Save to Parse
     $object = ParseObject::create("Transaction");
     $objectId = $object->getObjectId();
     // Set values:
     $object->set("name", $input['email']);
     $object->set("email", $input['stripeEmail']);
     $object->set("studentID", $input['IdNumber']);
     $object->set("sponsor", $input['sponsor']);
     $object->set("stripeToken", $input['stripeToken']);
     $object->set("used", false);
     $object->set("deal", env($input['sponsor'] . "_DEAL_TITLE"));
     $object->set("deployment", env('DEPLOYMENT'));
     $object->set("experation", env($input['sponsor'] . "_EXPIRATION"));
     // Save:
     $object->save();
     //data to pass
     $data = ["expirationdate" => env($input['sponsor'] . "_EXPIRATION"), "sponsorName" => env($input['sponsor'] . "_RETAILER"), "stripeOrderNumber" => $charge['id'], "price" => env($input['sponsor'] . "_PRICE"), "email" => $input['email'], "flag" => "true"];
     $email = $input['stripeEmail'];
     Mail::send('email.billing', $data, function ($message) use($email) {
         $message->to($email)->subject('Thank you for Your Order');
     });
     return View::make('thanks', $data)->with('data', $data);
 }
开发者ID:alecharmon,项目名称:DealSite,代码行数:33,代码来源:SubscribeController.php

示例8: testFunctionsWithObjectParamsFails

 public function testFunctionsWithObjectParamsFails()
 {
     $obj = ParseObject::create('SomeClass');
     $obj->set('name', 'Zanzibar');
     $obj->save();
     $params = ['key1' => $obj];
     $this->setExpectedException('\\Exception', 'ParseObjects not allowed');
     ParseCloud::run('foo', $params);
 }
开发者ID:louk,项目名称:One-Nice-Thing,代码行数:9,代码来源:ParseCloudTest.php

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

示例10: testParseBytesFromBase64Data

 public function testParseBytesFromBase64Data()
 {
     $obj = ParseObject::create('BytesObject');
     $bytes = ParseBytes::createFromBase64Data('R3JhbnRsYW5k');
     $obj->set('byteColumn', $bytes);
     $obj->save();
     $query = new ParseQuery('BytesObject');
     $objAgain = $query->get($obj->getObjectId());
     $this->assertEquals('Grantland', $objAgain->get('byteColumn'));
 }
开发者ID:aglo35,项目名称:vr_beta,代码行数:10,代码来源:ParseBytesTest.php

示例11: create

 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array $data
  *
  * @return User
  */
 public function create(array $data)
 {
     $userSubclass = ParseObject::getRegisteredSubclass('_User');
     $user = new $userSubclass();
     $user->username = isset($data['username']) ? $data['username'] : $data['email'];
     $user->email = $data['email'];
     $user->password = $data['password'];
     $user->signUp();
     return $user;
 }
开发者ID:khangaikh,项目名称:golocal,代码行数:17,代码来源:Registrar.php

示例12: dtestParseBytesFromBase64Data

 public function dtestParseBytesFromBase64Data()
 {
     $obj = ParseObject::create("TestObject");
     $bytes = ParseBytes::createFromBase64Data("R3JhbnRsYW5k");
     $obj->set("byteColumn", $bytes);
     $obj->save();
     $query = new ParseQuery("TestObject");
     $objAgain = $query->get($obj->getObjectId());
     $this->assertEquals("Grantland", $objAgain->get("byteColumn"));
 }
开发者ID:nidalb,项目名称:baas,代码行数:10,代码来源:ParseBytesTest.php

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

示例14: postUpdate

 public function postUpdate($objectId)
 {
     $object = ParseObject::create("todo", $objectId);
     if (\Input::has('title')) {
         $object->set("title", \Input::get('title'));
     }
     if (\Input::has('completed')) {
         $object->set("completed", filter_var(\Input::get('completed'), FILTER_VALIDATE_BOOLEAN));
     }
     $object->save();
 }
开发者ID:malimu,项目名称:baas,代码行数:11,代码来源:TodoController.php

示例15: validateCredentials

 /**
  * Validate a user against the given credentials.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable $user
  * @param  array                                      $credentials
  *
  * @return bool
  */
 public function validateCredentials(Authenticatable $user, array $credentials)
 {
     try {
         $username = $this->getUsernameFromCredentials($credentials);
         /** @var ParseUser $userClass */
         $userClass = ParseObject::getRegisteredSubclass('_User');
         $userClass::logIn($username, $credentials['password']);
         return true;
     } catch (ParseException $error) {
         return false;
     }
 }
开发者ID:khangaikh,项目名称:golocal,代码行数:20,代码来源:ParseUserProvider.php


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