Return item upvotes.

@param string $class

@return \Illuminate\Database\Eloquent\Relations\BelongsToMany
974227
public function upvotes($class = __CLASS__)
    {
        return $this->morphedByMany($class, config('follow.morph_prefix'), config('follow.followable_table'))
                    ->wherePivot('relation', '=', Follow::RELATION_UPVOTE)
                    ->withPivot('followable_type', 'relation', 'created_at');
    }
658168
public function get($class)
    {
        $pool = $this->map[$class]??null;
        if ($pool == null) {
            $pool = $this->applyNewPool($class);
        }
        if (!$pool->isEmpty()) {
            return $pool->shift();
        } else {
            $this->addNewCount($class);
            return new $class;
        }
    }
103502
public function getHooks($class)
    {
        $hooks = array();

        foreach (get_class_methods($class) as $method) {
            if (strpos($method, 'hook') === 0) {
                $hooks[] = $method;
            }
        }

        return $hooks;
    }
1117764
public function sources($class = null) {
		$this->_checkConnection();
		$conn = $this->connection;
		return array_map(function($col) { return $col->getName(); }, $conn->listCollections());
	}
152344
public function getBtn($class)
    {
        $buttons = null;
        $xPath = new DOMXPath($this->getDomXml());
        $nodeList = $xPath->query("//TAB[@cl='$class']/../BTN");
        if ($nodeList->length) {
            $buttons = new stdClass();
            foreach ($nodeList as $node) {
                $btnId = $node->getAttribute('id');
                $buttons->$btnId = 1;
            }
        }

        return $buttons;
    }
5
private function getRecursiveTraits($class = null)
    {
        if (null == $class) {
            $class = get_class($this);
        }

        $reflection = new \ReflectionClass($class);
        $traits = array_keys($reflection->getTraits());

        foreach ($traits as $trait) {
            $traits = array_merge($traits, $this->getRecursiveTraits($trait));
        }

        if ($parent = $reflection->getParentClass()) {
            $traits = array_merge($traits, $this->getRecursiveTraits($parent->getName()));
        }

        return $traits;
    }
532604
public function followings($class = __CLASS__)
    {
        $table = config('follow.followable_table');
        $foreignKey = config('follow.users_table_foreign_key', 'user_id');
        $targetTable = (new $class())->getTable();
        $tablePrefixedForeignKey = app('db.connection')->getQueryGrammar()->wrap(\sprintf('pivot_followables.%s', $foreignKey));
        $eachOtherKey = app('db.connection')->getQueryGrammar()->wrap('pivot_each_other');

        return $this->morphedByMany($class, config('follow.morph_prefix'), $table)
                    ->wherePivot('relation', '=', Follow::RELATION_FOLLOW)
                    ->withPivot('followable_type', 'relation', 'created_at')
                    ->addSelect("{$targetTable}.*", DB::raw("(CASE WHEN {$tablePrefixedForeignKey} IS NOT NULL THEN 1 ELSE 0 END) as {$eachOtherKey}"))
                    ->leftJoin("{$table} as pivot_followables", function ($join) use ($table, $class, $foreignKey) {
                        $join->on('pivot_followables.followable_type', '=', DB::raw(\addcslashes("'{$class}'", '\\')))
                            ->on('pivot_followables.followable_id', '=', "{$table}.{$foreignKey}")
                            ->on("pivot_followables.{$foreignKey}", '=', "{$table}.followable_id");
                    });
    }
234592
public function getPolicyFor($class)
    {
        if (is_object($class)) {
            $class = get_class($class);
        }

        if (! is_string($class)) {
            return;
        }

        if (isset($this->policies[$class])) {
            return $this->resolvePolicy($this->policies[$class]);
        }

        foreach ($this->guessPolicyName($class) as $guessedPolicy) {
            if (class_exists($guessedPolicy)) {
                return $this->resolvePolicy($guessedPolicy);
            }
        }

        foreach ($this->policies as $expected => $policy) {
            if (is_subclass_of($class, $expected)) {
                return $this->resolvePolicy($policy);
            }
        }
    }
1086889
public function getProperties(string $class){
        if(!class_exists($class)){
            throw new \InvalidArgumentException();
        }

        if(!array_key_exists($class, $this->props)){
            $this->props[$class]    = $this->getClass($class)->getProperties();
        }

        return $this->props[$class];
    }
333743
public function subscriptions($class = __CLASS__)
    {
        return $this->morphedByMany($class, config('follow.morph_prefix'), config('follow.followable_table'))
                    ->wherePivot('relation', '=', Follow::RELATION_SUBSCRIBE)
                    ->withPivot('followable_type', 'relation', 'created_at');
    }
892573
public function getImplements($class)
    {
        $interfaces = [];
        $classId = $this->getClassId($class);
        if (isset($classId)) {
            if (isset($this->implements[$classId])) {
                foreach ($this->implements[$classId] as $interfaceId) {
                    $interfaces[$this->interfaces[$interfaceId]] = 1;
                }
            }
            foreach ($this->getAncestors($class) as $parent) {
                foreach ($this->getImplements($parent) as $interface) {
                    $interfaces[$interface] = 1;
                }
            }
        }
        return array_keys($interfaces);
    }
1118012
static public function from($class)
        {
            if (is_object($class)) {
                $class = get_class($class);
            }

            if (empty(self::$prototypes[$class])) {
                self::$prototypes[$class] = new static($class);
            }

            return self::$prototypes[$class];
        }
927032
public function getByType($class)
    {
        $class = array_map('strtolower', (array)$class);

        $out = array_filter($this->_items, function ($assoc) use ($class) {
            list(, $name) = namespaceSplit(get_class($assoc));

            return in_array(strtolower($name), $class, true);
        });

        return array_values($out);
    }
1267125
public function hasManyAttachments($class, $link, $status = false)
    {
        return $this->owner->hasMany($class, $link)
            ->andWhere(['type' => $class::type(), 'status_id' => $class::STATUS_PERMANENT]);
    }
1086612
protected function getObjectRequestedById(string $class) {
	
		// reads from url requested item id
		$itemId = Router::get(0);
		
		if (!$itemId) {
			$this->enqueueError($this->lang('NO_ID_OF_ITEM_TO_EDIT', $class));
			return NULL;
		}
		
		$object = new $class($itemId);
	
		if ($object->isLoaded()) {
				
			return $object;
	
		} else {
	
			$this->enqueueError($this->lang('ID_OF_ITEM_TO_EDIT_IS_NOT_VALID', $class));
			$this->logError('Object ' . $class . ' id=' . $itemId . ' has not been loaded');
			return NULL;
	
		}
	
	}
881516
public function likes($class = __CLASS__)
    {
        return $this->morphedByMany($class, config('follow.morph_prefix'), config('follow.followable_table'))
                    ->wherePivot('relation', '=', Follow::RELATION_LIKE)
                    ->withPivot('followable_type', 'relation', 'created_at');
    }
1086834
public function favorites($class = __CLASS__)
    {
        return $this->morphedByMany($class, config('follow.morph_prefix'), config('follow.followable_table'))
                    ->wherePivot('relation', '=', Follow::RELATION_FAVORITE)
                    ->withPivot('followable_type', 'relation', 'created_at');
    }