Transform the resource into an array.

@param  \Illuminate\Http\Request
@return array
974951
public function toArray($request)
    {
        /** @var \Unite\Tags\Tag $this->resource */
        return [
            'id'                => $this->id,
            'name'              => $this->name,
            'type'              => $this->type,
            'custom_properties' => $this->custom_properties,
            'created_at'        => (string) $this->created_at,
        ];
    }
116454
public function toArray($request)
    {
        return [
            'id' => $this->id,
            'name' => $this->name,
            'identifier' => $this->identifier,
            'dropdown_options' => new AttributeDropdownOptionCollectionResource($this->attributeDropdownOptions),
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
        ];
    }
1300847
public function getFieldsFromRequest(array $request)
    {
        $keys = isset($request['field']) ? $request['field'] : null;
        $fields = [];
        if (is_array($keys)) {
            foreach ($this->groups as $group) {
                foreach ($group->getFields() as $field) {
                    if (in_array($field->getKey(), $keys)) {
                        $field->loadDataFromRequest($request);
                        $fields[] = $field;
                    }
                }
            }
        }

        return $fields;
    }
846512
protected function parseRequest(array $request) : array
    {
        $request = Collection::make($request);

        $allowed = $request->filter(function ($item) { return trim($item) != ''; })->only(array_keys($this->allowed));

        if ($filterable = $this->allowedFeatures($request)) {
            $allowed['features'] = $filterable;
        }

        return $allowed->all();
    }
457995
public static function fromArray(array $request)
    {
        $requestObject = new Request(
            $request['method'],
            $request['url'],
            isset($request['headers']) ? $request['headers'] : array()
        );

        if (!empty($request['post_fields']) && is_array($request['post_fields'])) {
            $requestObject->setPostFields($request['post_fields']);
        }

        if (!empty($request['post_files']) && is_array($request['post_files'])) {
            foreach ($request['post_files'] as $file) {
                $requestObject->addPostFile($file);
            }
        }

        if (!empty($request['body'])) {
            $requestObject->setBody((string)$request['body']);
        }

        return $requestObject;
    }
350665
protected function getTermData(Request $request)
    {
        $data = [];

        foreach ($this->repository as $field) {
            $data[$field->getName()] = $request->get($field->getName());
        }

        return $data;
    }
231891
public function parse(Request $request): array
    {
        // Extracts the GraphQL request parameters
        $parsedBody = $this->getParsedBody($request);
        $data = $this->getParams($request, $parsedBody);

        return $data;
    }
550518
private function getUriContext(Request $request): array
    {
        $context = $request->query->get('ngbmContext');
        $context = is_array($context) ? $context : [];

        if (!$this->uriSigner->check($this->getUri($request))) {
            return [];
        }

        return $context;
    }
931449
protected function getContentAsArray(Request $request)
    {
        $content = json_decode($request->getContent(), true);

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new BadRequestException();
        }

        if ($content === null) {
            return [];
        }

        return $content;
    }
615133
private function getParsedBody(Request $request): array
    {
        $body = $request->getContent();
        $contentType = \explode(';', (string) $request->headers->get('content-type'), 2)[0];

        switch ($contentType) {
            // Plain string
            case static::CONTENT_TYPE_GRAPHQL:
                $parsedBody = [static::PARAM_QUERY => $body];
                break;

            // JSON object
            case static::CONTENT_TYPE_JSON:
                if (empty($body)) {
                    throw new BadRequestHttpException('The request content body must not be empty when using json content type request.');
                }

                $parsedBody = \json_decode($body, true);

                if (\JSON_ERROR_NONE !== \json_last_error()) {
                    throw new BadRequestHttpException('POST body sent invalid JSON');
                }
                break;

            // URL-encoded query-string
            case static::CONTENT_TYPE_FORM:
                $parsedBody = $request->request->all();
                break;

            case static::CONTENT_TYPE_FORM_DATA:
                $parsedBody = $this->handleUploadedFiles($request->request->all(), $request->files->all());
                break;

            default:
                $parsedBody = [];
                break;
        }

        return $parsedBody;
    }
847499
public function get_items( $request ) {
		$data = array();
		foreach ( get_post_types( array(), 'object' ) as $obj ) {
			if ( empty( $obj->show_in_rest ) || ( 'edit' === $request['context'] && ! current_user_can( $obj->cap->edit_posts ) ) ) {
				continue;
			}
			$post_type = $this->prepare_item_for_response( $obj, $request );
			$data[ $obj->name ] = $this->prepare_response_for_collection( $post_type );
		}
		return rest_ensure_response( $data );
	}
260900
private function parseData($request)
    {
        $role     = $request->user()->role_id;
        $route    = explode('.', $request->route()->getName());
        $official = [
            'menu',
            'users',
            'roles',
            'actions'
        ];
        if (in_array($route[0], $official)) {
            return [$role, config('quickadmin.defaultRole')];
        } else {
            $menuName = $route[1];
        }
        $menu = Menu::where('name', ucfirst($menuName))->firstOrFail();

        return [$role, $menu];
    }
787818
private function input(Request $request)
    {
        $files = $request->files->all();

        array_walk_recursive($files, function (&$file) {
            $file = [
                'name' => $file->getClientOriginalName(),
                'size' => $file->isFile() ? ($file->getSize() / 1000).'KB' : '0',
            ];
        });

        return array_replace_recursive($request->input(), $files);
    }
211490
public function toArray() {
		return [
			'key' => $this->key(),
			'url' => $this->url(),
			'formData' => $this->formData(),
			'cacheControl' => $this->cacheControl(),
			'expires' => $this->expires(),
			'acl' => $this->acl()
		];
	}
388711
public function cgetAction(Request $request)
    {
        $ids = array_map(
            function($item) {
                $parts = explode(';', $item);

                return ['type' => $parts[0], 'id' => $parts[1]];
            },
            array_filter(explode(',', $request->get('ids', '')))
        );

        return $this->handleView(
            $this->view(
                new CollectionRepresentation(
                    $this->get('sulu_page.teaser.manager')->find($ids, $this->getLocale($request)),
                    'teasers'
                )
            )
        );
    }
645183
protected function getStrictRequestParameters(Request $request): array
    {
        $data = [];

        foreach ($this->strictUpdateKeys as $value) {
            if ($request->filled($value)) {
                $data[$value] = $request->input($value);
            }
        }

        return $data;
    }
471713
public function parse($request)
    {
        $object = clone $this->requestObject;
        $invalidValues = [];

        foreach ($this->propertyParsers as $propertyParser) {
            try {
                $this->setProperty($request, $object, $propertyParser);
            } catch (InvalidValueException $e) {
                $invalidValues[$propertyParser->getName()] = $e->getMessage();
            }
        }
        $this->checkIfRequestIsValidOrThrowException($invalidValues);

        return $object;
    }