Beispiel #1
0
 public function testGetLimitParsesThePageLimit()
 {
     $criteria = new Criteria(['page' => ['limit' => 100]]);
     $this->assertEquals(100, $criteria->getLimit());
 }
Beispiel #2
0
 /**
  * Extract parameters from the request input and assign them to the
  * request, restricted by the action's specifications.
  *
  * @param Request $request
  * @return JsonApiRequest
  */
 protected function buildJsonApiRequest(Request $request)
 {
     $request = new JsonApiRequest($request->input, $request->actor, $request->http);
     $criteria = new Criteria($request->input);
     event(new BuildApiAction($this));
     $request->include = $this->sanitizeInclude($criteria->getInclude());
     $request->sort = $this->sanitizeSort($criteria->getSort());
     $request->offset = $criteria->getOffset();
     $request->limit = $this->sanitizeLimit($criteria->getLimit());
     $request->link = $this->link;
     return $request;
 }
Beispiel #3
0
 /**
  * Extract parameters from the request input and assign them to the
  * request, restricted by the action's specifications.
  *
  * @param \Flarum\Api\Request $request
  * @return void
  */
 protected static function buildJsonApiRequest(Request $request)
 {
     $request = new JsonApiRequest($request->input, $request->actor, $request->http);
     $criteria = new Criteria($request->input);
     $request->include = static::sanitizeInclude($criteria->getInclude());
     $request->sort = static::sanitizeSort($criteria->getSort());
     $request->offset = $criteria->getOffset();
     $request->limit = static::sanitizeLimit($criteria->getLimit());
     $request->link = static::$link;
     return $request;
 }