Convert the model instance to an array. This method overrides that of
Eloquent to prevent relations to be serialize into output array.

@return array
198182
public function toArray()
    {
        $relations = [];
        $arrayableRelations = [];

        // include any relations exposed by default
       foreach ($this->exposedRelations as $relation) {
            // skip loading a relation if it is from a method
            if (in_array($relation, $this->relationsFromMethod)) {
                // if the relation hasnt been loaded, then load it
                if (!isset($this->$relation)) {
                    $this->$relation = $this->$relation();
                }

                $arrayableRelations[$relation] = $this->$relation;
                continue;
            }

            $this->load($relation);
        }

        // fetch the relations that can be represented as an array
        $arrayableRelations = array_merge($this->getArrayableRelations(), $arrayableRelations);

        // add the relations to the linked array
        foreach ($arrayableRelations as $relation => $value) {
            if (in_array($relation, $this->hidden)) {
                continue;
            }

            if ($value instanceof Pivot) {
                continue;
            }

            if ($value instanceof BaseModel) {
                $relations[$relation] = array('linkage' => array('id' => (string)$value->getKey(), 'type' => $value->getResourceType()));
            } elseif ($value instanceof Collection) {
                $relation = \str_plural($relation);
                $items = ['linkage' => []];
                foreach ($value as $item) {
                    $items['linkage'][] = array('id' => (string)$item->getKey(), 'type' => $item->getResourceType());
                }
                $relations[$relation] = $items;
            }

            // remove models / collections that we loaded from a method
            if (in_array($relation, $this->relationsFromMethod)) {
                unset($this->$relation);
            }
        }

        //add type parameter
        $model_attributes = $this->attributesToArray();
        unset($model_attributes[$this->primaryKey]);

        $attributes = [
            'id'         => (string)$this->getKey(),
            'type'       => $this->getResourceType(),
            'attributes' => $model_attributes
        ];

        if (! count($relations)) {
            return $attributes;
        }

        return array_merge(
            $attributes,
            [ 'links' => $relations ]
        );
    }
801012
public function toArray()
    {
        $this->buildGroupsCollection();

        return parent::toArray() + [
                'stub'             => $this->stubElements,
                'name'             => $this->relationName,
                'label'            => $this->label,
                'groups'           => $this->groups,
                'remove'           => $this->toRemove,
                'newEntitiesCount' => $this->new,
                'limit'            => $this->limit,
            ];
    }
1136891
public function __toArray()
    {
        $result = array();
        $idx = 0;
        foreach ($this->var as $idx => $line) {
            $result[] = $line->__toFields();
        }
        return $result;
    }
899965
public function toArray()
    {
        $attributesToArray = [];
        foreach ($this->attributesToArray() as $attr => $value) {
            if (!starts_with($attr, '__i18n__')) {
                $attributesToArray[$attr] = $value;
            }
        }

        return array_merge($attributesToArray, $this->relationsToArray());
    }
276049
public function toArray(): array
	{
		$array = [
			'id' => $this->getId(),
		];
		foreach (get_object_vars($this) as $prop => $value) {
			$array[$prop] = is_callable([$this->$prop,'toArray'])? $this->$prop->toArray() : $this->$prop;
		}

		return $array;
	}
1060449
public function relationsToArray()
    {
        $attributes = [];

        foreach ($this->getArrayableRelations() as $key => $value) {
            if ($value instanceof Model) {
                $relation = $value->toArray();
            } elseif (is_array($value)) {
                $relation = $value;
            } elseif (is_null($value)) {
                $relation = $value;
            }

            // If the relationships snake-casing is enabled, we will snake case this
            // key so that the relation attribute is snake cased in this returned
            // array to the developers, making this consistent with attributes.
            if (static::$snakeAttributes) {
                $key = str_snake($key);
            }

            // If the relation value has been set, we will set it on this attributes
            // list for returning. If it was not arrayable or null, we'll not set
            // the value on the array because it is some type of invalid value.
            if (isset($relation) || is_null($value)) {
                $attributes[$key] = $relation;
            }

            unset($relation);
        }

        return $attributes;
    }
1222475
public function toArray()
    {
        $out = [];
        foreach ($this as $key => $value) {
            $getter = sprintf('get%s', $key);
            if (!is_object($value) && method_exists($this, $getter)) {
                $out[$key] = call_user_func([$this, $getter]);
            }
        }

        return $out;
    }
43428
public function toArray()
    {
        $result = array();
        if($entity = $this->getIterator()->current()) {
            $result = $entity->toArray();
        }

        return $result;
    }
1345106
public function toArray()
    {
        $schema = array(
            'name' => $this->_name,
            'label' => $this->_label,
            'description' => $this->_description,
            'type' => $this->_type,
            'store' => $this->_isStored,
            'index' => $this->_isIndexd,
            'multivalue' => $this->_isMultiValued,
        );

        if (isset($this->_size)) {
            $schema['size'] = $this->_size;
        }

        return $schema;
    }
482631
public function toArray()
    {
        $fieldValues = [];
        foreach ($this->fieldsets as $fieldset) {
            $fieldValues = array_merge($fieldValues, $fieldset->toArray());
        }
        return $fieldValues;
    }
398583
public function toArray()
    {
        return [
            'field' => $this->column,
            'references' => $this->references,
            'on' => $this->on,
            'on-delete' => $this->onDelete,
            'on-update' => $this->onUpdate,
            'references-model' => $this->getReferencesModel(),
            'is-self-reference' => $this->isSelfReference(),
        ];
    }
738012
public function toArray()
	{
		return [
			'name' => (string) $this->name,
			'email' => SerializationHelper::serialize($this->email),
			'links' => SerializationHelper::serialize($this->links)
		];
	}
575776
public function &toArray()
    {
        if (!isset($this->__propertyToData[Schema::DEFAULT_MAPPING])) {
            return $this->__arrayOfData;
        }
        if (null === $this->__mappedProperties) {
            $properties = array();
            foreach ($this->__arrayOfData as $propertyName => $property) {
                if (isset($this->__propertyToData[Schema::DEFAULT_MAPPING][$propertyName])) {
                    $propertyName = $this->__propertyToData[Schema::DEFAULT_MAPPING][$propertyName];
                }
                $properties[$propertyName] = $property;
            }
            $this->__mappedProperties = $properties;
        }
        return $this->__mappedProperties;
    }
729357
public function accessibleRelationsToArray()
	{
		$filtered  = [];
		$relations = $this->getArrayableRelations();

		/**
		 * @var $related \Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Relations\Pivot
		 */
		foreach ($relations as $key => $related_collection) {
			if (! $this->access_authorizer->canAccess($key)) {
				continue;
			}

			if ($related_collection instanceof Pivot) {
				// Access test done above
				$filtered[$key] = $related_collection;
				continue;
			}

			// Many relation
			if ($related_collection instanceof Collection) {
				foreach ($related_collection as $index => $related) {
					$filtered[$key][$index] = $related->accessibleAttributesToArray();
				}
			} elseif ($related_collection instanceof LaravelModel) {
				// Single relation
				$filtered[$key] = $related_collection->accessibleAttributesToArray();
			}
		}

		return $filtered;
	}
480846
public function toArray()
    {
        $methods = array();
        foreach ($this->getMethods() as $key => $method) {
            $methods[$key] = $method->toArray();
        }
        return $methods;
    }
328655
public function toArray(): array
    {
        return [
            'name' => $this->name,
            'method' => $this->method,
            'url' => $this->url,
            'model' => $this->model,
            'view' => $this->view,
            'controller' => $this->controller,
            'action' => $this->action,
            'default' => $this->default,
            'param' => $this->param,
            'callback' => $this->callback
        ];
    }
1043480
public function toArray()
    {
        return array_map(static function ($value) {
            if ($value instanceof ArraySerializableInterface) {
                $value = $value->toArray();
            }
            return $value;
        }, get_object_vars($this));
    }