Transform the resource into an array.

@param  \Illuminate\Http\Request $request request

@return array
18245
public function toArray($request)
    {
        return [
            'id'                 => (int) $this->id,
            'parent_id'          => $this->parent_id,
            'author_id'          => $this->author_id,
            'level'              => $this->level,
            'type'               => $this->whenLoaded('type', function () {
                return $this->type->name;
            }),
            'thumbnail'          => $this->whenLoaded('thumb', function () {
                return new File($this->thumb);
            }),
            'theme'              => $this->theme,
            'weight'             => $this->weight,
            'rating'             => $this->rating,
            'is_on_home'         => $this->is_on_home,
            'is_comment_allowed' => $this->is_comment_allowed,
            'is_promoted'        => $this->is_promoted,
            'is_sticky'          => $this->is_sticky,
            'path'               => $this->buildPath($this->path),
            'published_at'       => optional(dateTimeToRequestTimezone($this->published_at))->toIso8601String(),
            'created_at'         => dateTimeToRequestTimezone($this->created_at)->toIso8601String(),
            'updated_at'         => dateTimeToRequestTimezone($this->updated_at)->toIso8601String(),
            'routes'             => $this->whenLoaded('routes', function () {
                return Route::collection($this->routes);
            }),
            'translations'       => ContentTranslation::collection($this->whenLoaded('translations')),
            'children'           => $this->when(!empty($this->children), function () {
                return Content::collection($this->children);
            }),
        ];
    }
1125512
public function getConfiguration(Request $request)
    {
        $this->request = $request;

        return [
            'base_uri' => $request->getOptions()->get('base_url'),
            'headers'  => $request->getHeaders()->all(),
            'query'    => $request->getParameters()->all()
        ];
    }
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();
    }
755969
private function getParametersFromRequest(Request $request)
    {
        $parameters = $request->query->all();
        if ($routeParameters = $request->attributes->get('_route_params')) {
            $parameters = array_merge($routeParameters, $parameters);
        }

        return $parameters;
    }
1126326
public function toArray($request)
    {
        return [
            'id'         => (int) $this->id,
            'email'      => $this->email,
            'name'       => $this->name,
            'first_name' => $this->first_name,
            'last_name'  => $this->last_name,
            'roles'      => Role::collection($this->whenLoaded('roles')),
        ];
    }
414688
protected function createRequestBody(Request $request) : array
    {
        $requests = array_map(
            function(RpcRequest $request) {
                return base64_encode($request->toProtobufRequest()->toStream()->getContents());
            },
            $request->getRequests()
        );

        return array(
            'Timestamp'   => $request->getTimestamp(),
            'Latitude'    =>  $request->getPosition()->getLatitude(),
            'Longitude'   => $request->getPosition()->getLongitude(),
            'Altitude'    => $request->getPosition()->getAltitude(),
            'AuthTicket'  => base64_encode($request->getAuthData()->getData()),
            'SessionData' => base64_encode($request->getSessionHash()),
            'Requests'    => $requests
        );
    }
476120
private function mapRequestToParentGroups(Request $request)
    {
        $groupId = $this->repository->getLocationService()->loadLocation(
            $this->parseContentRequest($request)->locationCreateStruct->parentLocationId
        )->contentId;
        $group = $this->repository->getUserService()->loadUserGroup($groupId);

        return [$group];
    }
645183
protected function getStrictRequestParameters(Request $request): array
    {
        $data = [];

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

        return $data;
    }
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;
    }
1198459
private function transformRequest(Request $request)
    {
        $method = $request->getMethod();
        $url = (string) $request->getUrl();
        $options = [
            'version' => $request->getProtocolVersion(),
            'headers' => $request->getHeaders(),
        ];

        if ($body = $request->getBody()) {
            $options['body'] = $body->detach();
        }

        return $this->client->createRequest($method, $url, $options);
    }
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];
    }
1209172
public function toArray($request)
    {
        /** @var \Unite\Transactions\Models\Transaction $this->resource */
        return [
            'id'                 => $this->id,
            'type'               => $this->type,
            'subject_type'       => $this->subject_type,
            'subject_id'         => $this->subject_id,
            'amount'             => $this->amount,
            'balance'            => $this->balance,
            'variable_symbol'    => (int)$this->variable_symbol,
            'specific_symbol'    => (int)$this->specific_symbol,
            'description'        => $this->description,
            'posted_at'          => (string)$this->posted_at,
            'created_at'         => (string)$this->created_at,
            'destination_iban'   => $this->destination_iban,
            'transaction_source' => new SourceResource($this->source)
        ];
    }
1137269
public function toArray($request)
    {
        return [
            'id'            => (int) $this->id,
            'author_id'     => $this->author_id,
            'language_code' => $this->language_code,
            'title'         => $this->title,
            'description'   => $this->description,
            'created_at'    => $this->created_at->toIso8601String(),
            'updated_at'    => $this->updated_at->toIso8601String(),
        ];
    }
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;
    }
1295838
public function listRoles(Request $request)
    {
        $roles = array();
        if ($request->query->has('identifier')) {
            try {
                $role = $this->roleService->loadRoleByIdentifier($request->query->get('identifier'));
                $roles[] = $role;
            } catch (APINotFoundException $e) {
                // Do nothing
            }
        } else {
            $offset = $request->query->has('offset') ? (int)$request->query->get('offset') : 0;
            $limit = $request->query->has('limit') ? (int)$request->query->get('limit') : -1;

            $roles = array_slice(
                $this->roleService->loadRoles(),
                $offset >= 0 ? $offset : 0,
                $limit >= 0 ? $limit : null
            );
        }

        return new Values\RoleList($roles, $request->getPathInfo());
    }
27201
protected function parseIncomingRequest($request)
    {
        if (! $request) {
            $request = LumenRequest::capture();
        }

        $this->instance(Request::class, $this->prepareRequest($request));

        return [$request->getMethod(), '/'.\trim($request->getPathInfo(), '/')];
    }
94424
public static function getHeadersFromRequest(Request $request)
    {
        $headers = array();
        foreach($request->headers as $key => $value)
        {
            if(isset($key) && isset($value) && isset($value[0]))
            {
                $headers[$key] = $value[0];
            }
        }
        return $headers;
    }