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