Vote a item or items.

@param  int|array|\Illuminate\Database\Eloquent\Model $item
@param  string $type
@return boolean
192383
public function vote($item, $type = 'up_vote')
    {
        $items = array_fill_keys((array) $this->checkVoteItem($item), ['type' => $type]);

        return $this->votedItems()->sync($items, false);
    }
538483
protected function formatItem(string $type, $item): array
    {
        $formattedItem = [];

        if ('route' === $type) {
            return [
            'item_name' => $item,
            ];
        }

        $model = $item['model'];
        $formattedItem['item_name'] = $model;
        if (is_object($model)) {
            $formattedItem['item'] = $model;
            $formattedItem['item_name'] = get_class($model);
        }
        if ('field' === $type) {
            $formattedItem['item_name'] .= ":{$item['field']}";
        }

        return $formattedItem;
    }
996732
protected function checkType($item)
    {
        $type = $this->getItemType($item);
        if (! $this->type) {
            $this->type = $type;

            return true;
        }

        if ($this->type != $type) {
            return false;
        }

        return true;
    }
235934
protected function isCorrectType($item)
    {
        if (is_null($this->type)) {
            return true;
        }

        if ($this->type !== 'object' && is_object($item)) {
            return $item instanceof $this->type;
        }

        return gettype($item) === $this->type;
    }
919194
public function checkItemIsActive($item)
    {
        if ($this->getActive()) {
            return true;
        }

        if (empty($item_list = $item->getHideIfItemNotActiveOption())) {
            return true;
        }

        if (!is_array($item_list)) {
            $item_list = [$item_list];
        }

        foreach ($item_list as $nickname) {
            $check_item = $item->getMenu()->get($nickname);

            if (!is_null($check_item) && $check_item->getActive()) {
                return true;
            }
        }

        return false;
    }
287683
public function hasItemModel(core_kernel_classes_Resource $item, $models)
    {
        $returnValue = (bool)false;

        $itemModel = $item->getOnePropertyValue($this->itemModelProperty);
        if ($itemModel instanceof core_kernel_classes_Resource) {
            if (in_array($itemModel->getUri(), $models)) {
                $returnValue = true;
            }
        }

        return (bool)$returnValue;
    }
1255226
public function add ($item) {
        if (!$this->getConnection ()->getClient ()->sadd ($this->name , $item)) {
            return false;
        }
        $this->_data = null;
        $this->_count = null;
        return true;
    }
585688
public function addItem($item)
	{
		if( ! $item instanceof Model )
		{
			$item = new $this->defaultModel($item);
		}

		$this->data[] = $item;
	}
563744
private function findItemIn($item, $key)
	{
		$array = $this->find($key);
		if($array) return $this->array_get($array, $item);
		return false;
	}
427057
protected function filter( string $item ): bool {

		foreach ( self::$skip as $match ) {
			if ( false !== strpos( $item, $match ) ) {
				return false;
			}
		}

		return true;
	}
1042755
public function add($item)
    {
        if (is_numeric($item)) {
            $item = DataObject::get_by_id($this->dataClass, $item);
        } elseif (!($item instanceof $this->dataClass)) {
            user_error("HasManyList::add() expecting a $this->dataClass object, or ID value", E_USER_ERROR);
        }

        $foreignID = $this->getForeignID();

        // Validate foreignID
        if (!$foreignID) {
            user_error("HasManyList::add() can't be called until a foreign ID is set", E_USER_WARNING);
            return;
        }
        if (is_array($foreignID)) {
            user_error("HasManyList::add() can't be called on a list linked to mulitple foreign IDs", E_USER_WARNING);
            return;
        }

        $foreignKey = $this->foreignKey;
        $item->$foreignKey = $foreignID;

        $item->write();
    }
438035
public function enqueue($item): bool {
        if (!$this->isValid()) return false;

        $this->queue[$this->head] = $item;
        $this->head++;
        return true;
    }
1069133
public function addItem($item)
    {
        if (!isset($this->_items)) {
            $this->_items = [];
        }
        if (!is_array($item)) {
            $item = [];
        }
        if (!isset($item['class'])) {
            $item['class'] = $this->itemClass;
        }
        $item = Yii::createObject($item);
        $this->_items[$item->id] = $item;

        return $item;
    }
1001074
public function saveData($item)
    {
        $attributes = $item->dataProperties->getAttributesForSave($item->id);
        if(empty($attributes)) return false;

        $classData = static::getClassData();

        foreach ($attributes as $slug => $values)
        {

            $classData::deleteAll(['item_id' => $item->id, 'property_slug' => $slug]);
            $values = (is_array($values)) ? $values : [$values];

            foreach ($values as $value){

                $value = (is_array($value)) ? array_values($value)[0] : $value;

                $data = new $classData;
                $data->value = $value;
                $data->property_slug = $slug;
                $data->item_id = $item->id;
                if(!empty($value)) $data->save();
            }
        }
    }
969098
protected function convertItem($item)
    {
        foreach ($item as $key => $value) {
            if (!isset($this->converters[$key])) {
                continue;
            }

            foreach ($this->converters[$key] as $converter) {
                $item[$key] = call_user_func($converter, $item[$key]);
            }
        }

        return $item;
    }
209485
public function delete(Model $item)
    {
        if (method_exists($item, 'trashed') && $item->trashed()) {
            return $item->forceDelete();
        }

        return $item->delete();
    }
91612
protected function checkVoteItem($item)
    {
        if ($item instanceof \Illuminate\Database\Eloquent\Model) {
            $this->setVoteRelation(get_class($item));
            return $item->id;
        };

        return $item;
    }