Prepare the attributes of the entity that has to be persisted.

@return array The prepared attributes
355132
protected function prepareAttributes()
    {

        // initialize the values that has to be updated
        $updatedAt = date('Y-m-d H:i:s');
        $childrenCount = $this->loadCategoryChildrenChildrenCount($this->category[MemberNames::PATH] . '/%');

        // prepare and return the array with the updated values
        return array(
            MemberNames::UPDATED_AT     => $updatedAt,
            MemberNames::CHILDREN_COUNT => $childrenCount
        );
    }
110664
protected function prepareConfig()
    {
        $config = config("entity", []);

        $entity = $this->entity;

        if(!isset($config[$entity])){

            throw new \Exception("No configuration found for entity {$entity}.");

        }

        // assign the given config
        $this->config = $config[$entity] + [
            'attributes'    => [],
            'relationships' => [],
            'scope'         => Scope::DISABLED,
        ];

        // merge attribute defaults
        foreach($this->config['attributes'] as $attr => $values){

            $this->config['attributes'][$attr] = $this->applyAttributeDefaults($values);

        }

        // merge relationship defaults
        foreach($this->config['relationships'] as $rel => $values){

            $this->config['relationships'][$rel] = $this->applyRelationshipDefaults($values);
        }

        $this->fillable(array_keys($this->config['attributes']));
    }
676723
protected function prepareProductSuperLinkAttributes()
    {

        // initialize and return the entity
        return $this->initializeEntity(
            array(
                MemberNames::PRODUCT_ID => $this->childId,
                MemberNames::PARENT_ID  => $this->parentId
            )
        );
    }
585243
public function prepareAttributes()
    {
        $attrs = [];

        $this->prepare($attrs);

        $attrs = array_merge($attrs, (array) $this->getAttribute('attribs'));

        return $attrs;
    }
793722
public function getPersistedAttributes() {
    $persisted = static::getAllPersistedAttributes();
    if (empty($persisted)) {
      // if the static persisted declaration is empty return empty
      return [];
    } else {
      // otherwise add the instance variables for primaryKey, typeField and dates
      return array_merge([$this->primaryKey, static::$singleTableTypeField], static::getAllPersistedAttributes(), $this->getDates());
    }
  }
119564
protected function defineAttributes()
    {
        $attributes = array(
                'id' => AttributeType::Number,
                'providerHandle' => AttributeType::String,
                'pluginHandle' => AttributeType::String,
                'accessToken' => AttributeType::String,
                'secret' => AttributeType::String,
                'endOfLife' => AttributeType::String,
                'refreshToken' => AttributeType::String,
            );

        return $attributes;
    }
983910
public function getEntitiesAttribute()
    {
        return DB::table(config('rinvex.attributable.tables.attribute_entity'))->where('attribute_id', $this->getKey())->get()->pluck('entity_type')->toArray();
    }
924815
public function getAttributes()
    {
        return [
            Attributes\IdAttribute::make(),
            Attributes\TextAttribute::make('name')
                ->setRequired(true)
                ->setUnique(true),
            Attributes\LongTextAttribute::make('description'),
            Attributes\TextAttribute::make('filter'),
            Attributes\ClassNameAttribute::make('class_name', [\Railken\Amethyst\Contracts\DataBuilderContract::class]),
            Attributes\YamlAttribute::make('class_arguments'),
            Attributes\YamlAttribute::make('mock_data'),
            Attributes\YamlAttribute::make('input'),
            Attributes\TextAttribute::make('include'),
            Attributes\CreatedAtAttribute::make(),
            Attributes\UpdatedAtAttribute::make(),
            Attributes\DeletedAtAttribute::make(),
        ];
    }
1076650
protected function prepareAttributes()
    {

        // load the ID of the product that has been created recently
        $lastEntityId = $this->getSubject()->getLastEntityId();

        // initialize the stock status data
        $websiteId =  $this->getValue(ColumnKeys::WEBSITE_ID, 0);

        // return the prepared stock status
        return $this->initializeEntity(
            array(
                MemberNames::PRODUCT_ID   => $lastEntityId,
                MemberNames::WEBSITE_ID   => $websiteId,
                MemberNames::STOCK_ID     => 1
            )
        );
    }
536204
protected function prepareAttributes()
    {

        // load the store view code
        $storeViewCode = $this->getStoreViewCode(StoreViewCodes::ADMIN);

        // load the store/website ID
        $store = $this->getStoreByStoreCode($storeViewCode);
        $websiteId = $store[MemberNames::WEBSITE_ID];

        // load parent/option ID
        $parentId = $this->mapSku($this->getValue(ColumnKeys::BUNDLE_PARENT_SKU));

        // load the default values
        $selectionPriceValue = $this->getValue(ColumnKeys::BUNDLE_VALUE_PRICE);

        try {
            // try to load the selection price type
            $selectionPriceType = $this->mapPriceType($this->getValue(ColumnKeys::BUNDLE_VALUE_PRICE_TYPE));
        } catch (\Exception $e) {
            throw $this->wrapException(array(ColumnKeys::BUNDLE_VALUE_PRICE_TYPE), $e);
        }

        try {
            // try to load the selection ID for the child SKU
            $selectionId = $this->getChildSkuSelectionMapping($this->getValue(ColumnKeys::BUNDLE_VALUE_SKU));
        } catch (\Exception $e) {
            throw $this->wrapException(array(ColumnKeys::BUNDLE_VALUE_SKU), $e);
        }

        // return the prepared bundle selection price
        return $this->initializeEntity(
            array(
                MemberNames::SELECTION_ID          => $selectionId,
                MemberNames::PARENT_PRODUCT_ID     => $parentId,
                MemberNames::WEBSITE_ID            => $websiteId,
                MemberNames::SELECTION_PRICE_TYPE  => $selectionPriceType,
                MemberNames::SELECTION_PRICE_VALUE => $selectionPriceValue
            )
        );
    }
1003281
protected function prepareAttributes()
    {

        // load the subject
        $subject = $this->getSubject();

        // load the ID of the product that has been created recently
        $lastEntityId = $subject->getLastEntityId();

        try {
            // load the category for the found path
            $category = $this->getCategoryByPath($this->path);

            // return the prepared category product relation
            return $this->initializeEntity(
                array(
                    MemberNames::CATEGORY_ID => $category[MemberNames::ENTITY_ID],
                    MemberNames::PRODUCT_ID  => $lastEntityId,
                    MemberNames::POSITION    => 0
                )
            );
        } catch (\Exception $e) {
            // query whether or not debug mode has been enabled
            if ($subject->isDebugMode()) {
                $subject->getSystemLogger()->warning($subject->appendExceptionSuffix($e->getMessage()));
            } else {
                throw $e;
            }
        }
    }
854662
protected function prepareAllAttributes() {
    static::$all_attributes = static::$my_attributes;
    $parent = get_class($this);
    while (($parent = get_parent_class($parent)) != 'Palmabit\Library\Models\SingleTableInheritance') {
      static::$all_attributes = array_merge(static::$all_attributes, $parent::$my_attributes);
    }
  }
1019965
protected function prepareAttributes()
    {

        // load the ID of the last link
        $linkId = $this->getLastLinkId();

        // load the product link attribute ID
        $productLinkAttributeId = $this->getProductLinkAttributeId();

        // load the position value
        $value = $this->getValue(ColumnKeys::LINK_TYPE_ATTRIBUTE_VALUE);

        // initialize and return the entity
        return $this->initializeEntity(
            array(
                MemberNames::PRODUCT_LINK_ATTRIBUTE_ID => $productLinkAttributeId,
                MemberNames::LINK_ID                   => $linkId,
                MemberNames::VALUE                     => $value
            )
        );
    }
666090
function attributes()
    {
        $attributes = array();
        $item = $this->InternalAttributes['item'];
        if ( is_array( $item ) )
        {
            $attributes = array_keys( $item );
        }
        else if ( is_object( $item ) and
                  method_exists( $item, 'attributes' ) )
        {
            $attributes = $item->attributes();
        }
        $attributes = array_merge( $this->InternalAttributes, $attributes );
        $attributes = array_unique( $attributes );
        return $attributes;
    }
508455
protected function getUpdatedEventAttributes(): array
    {
        $old = [];
        $new = [];

        foreach ($this->getDirty() as $attribute => $value) {
            if ($this->isAttributeAuditable($attribute)) {
                $old[$attribute] = Arr::get($this->original, $attribute);
                $new[$attribute] = Arr::get($this->attributes, $attribute);
            }
        }

        return [
            $old,
            $new,
        ];
    }
1307690
protected function prepareAttributes(array $attributes)
    {
        foreach ($attributes as $key => $value) {
            if (is_numeric($key)) {
                unset($attributes[$key]);
                $attributes[$value] = true;
                continue;
            }
        }

        if (isset($attributes['null'])) {
            unset($attributes['null']);
            $attributes['notnull'] = false;
        }

        return $attributes;
    }
1150065
public function getAttributes()
    {
        $attributeEntities = $this->entity->getProductAttributes();

        $attributes = [];
        foreach ($attributeEntities as $attributesEntity) {
            $attributes[] = new ProductAttribute(
                $attributesEntity,
                $this->locale,
                $this->productLocaleManager->getFallbackLocale()
            );
        }

        return $attributes;
    }