/** * @param string $action * @param array $parameters * @return Context|string */ protected function getContext($action = Action::VIEW, $parameters = []) { $context = new Context($action, $parameters); if ($toShow = Request::input('fields')) { $context->showFields(array_map('trim', explode(',', $toShow))); } if ($toExpand = Request::input('expand')) { $context->expandFields(array_map('trim', explode(',', $toExpand))); } $context->addProcessor(new PaginationProcessor(CursorPaginationBuilder::class)); $context->setUrl(Request::url()); return $context; }