/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $query = new ParseQuery("Inventory"); $results = $query->find(); foreach ($results as $key => $value) { $availableinventory[] = array("objectId" => $value->getobjectId(), "type" => $value->Type, "description" => $value->Description, "stock" => $value->Stock); } // var_dump($availableinventory); $view = view('selectorders')->with('availableinventory', $availableinventory); return $view; }
/** * Constructs a ParseQuery object that is the OR of the passed in queries objects. * All queries must have same class name. * * @param array $queryObjects Array of ParseQuery objects to OR. * * @return ParseQuery The query that is the OR of the passed in queries. * * @throws \Exception If all queries don't have same class. */ public static function orQueries($queryObjects) { $className = null; $length = count($queryObjects); for ($i = 0; $i < $length; $i++) { if (is_null($className)) { $className = $queryObjects[$i]->className; } if ($className != $queryObjects[$i]->className) { throw new \Exception("All queries must be for the same class"); } } $query = new ParseQuery($className); $query->_or($queryObjects); return $query; }
/** * Gets a query that can be used to query the objects in this relation. * * @return ParseQuery That restricts the results to objects in this relations. */ public function getQuery() { $query = new ParseQuery($this->targetClassName); $query->relatedTo('object', $this->parent->_toPointer()); $query->relatedTo('key', $this->key); return $query; }
<?php require 'autoload.php'; use Parse\ParseClient; use Parse\ParseObject; /* Get post values from ajax */ $masterId = $_POST['masterid']; $restId = $_POST['restId']; $parseClass = $_POST['parseclass']; $appId = $_POST['appid']; ParseClient::initialize($appId, $restId, $masterId); $query = new ParseQuery("TestObject"); // Get a specific object: $object = $query->get("anObjectId");