Filters the primary connections by ones that are currently active.

@return mixed
160600
public function getCurrentFriendsAttribute()
    {
        return $this->friends->filter(function ($item) {
            $now = new \Carbon\Carbon;

            if(!$item->pivot->approved_at)
            {
                return false;
            }

            switch (true) {
                // no dates set
                case !$item->pivot->end && !$item->pivot->start:

                    // start is set but is in the future
                case !$item->pivot->end && $item->pivot->start && $item->pivot->start < $now:

                    // end is set but is in the past
                case !$item->pivot->start && $item->pivot->end && $item->pivot->end > $now:

                    // both start and end are set, but we are currently between those dates
                case $item->pivot->start && $item->pivot->start < $now && $item->pivot->end && $item->pivot->end > $now:

                    return true;
                    break;
            }

            // any other scenario fails
            return false;
        });
    }
143055
public function getLinks()
    {
        if ($this->filterCallback === null) {
            $links = $this->links;
        } else {
            $links = array_filter($this->links, function (Link $linkObj) {
                /*@var $linkObj Link */
                return $linkObj->shouldNotVisit() === false;
            });
        }
        
        return $links;
    }
381560
protected function nestedConnections()
    {
        $queries = [];
        $inst = $this->getDataObjectInstance();
        foreach ($this->nestedQueries as $name => $q) {
            $result = $inst->obj($name);
            if ($result instanceof DataList || $result instanceof UnsavedRelationList) {
                $queries[$name] = $result->dataClass();
            }
        }

        return $queries;
    }
1013741
protected function getConnectionData()
	{
		return [$this->associativeLocal => $this->model->getPkValue(), $this->shifter => strtolower($this->model->getModelName())];
	}
480370
public function get_active()
    {
        if ($this->active !== null) {
            return $this->active;
        }

        if (!$this->sieve) {
            return $this->_set_error(self::ERROR_INTERNAL);
        }

        return $this->active = $this->sieve->getActive();
    }
291270
protected function verifyConnection()
    {
        if (count(config('database.connections', [])) > 1) {
            $connections = array_keys(config('database.connections'));
            $default = array_search(config('database.default'), $connections);

            return $this->choice('Which connection do we use?', $connections, $default);
        }

        return config('database.default');
    }
87303
public function setActiveConnections($connections)
    {
        if (!is_array($connections)) {
            $connections = explode(',', $connections);
        }

        // Sanitize and set connections
        $filtered = array_filter($connections, [$this, 'isValidConnection']);
        if (!$filtered) {
            throw new ConnectionException('Invalid connection(s): '.implode(', ', $connections));
        }

        $this->available = $this->getConnections()->map(function (ConnectionInterface $connection) use ($connections) {
            $connectionKey = $connection->getConnectionKey();
            $handle = $connectionKey->toHandle();

            $connection->setActive(in_array($handle, $connections, true) || in_array($connectionKey->name, $connections, true));
            $connection->setCurrent(false);

            return $connection;
        });
    }
929437
public function getActiveServices()
    {
        $active = array();
        foreach ($this->getExtensions() as $handle) {
            $service = $this->getService($handle);
            $version = $service->getDetector()->detect();
            if ($version !== null) {
                $active[] = $this->getService($handle, $version);
            }
        }

        return $active;
    }
679556
public function getConnection()
    {
        if (!$this->connection) {
            if ($this->connectionName) {
                $this->connection = $this->mandango->getConnection($this->connectionName);
            } else {
                $this->connection = $this->mandango->getDefaultConnection();
            }
        }

        return $this->connection;
    }
550497
public function getDefaultConnection()
    {
        if (null === $this->defaultConnectionName) {
            throw new \RuntimeException('There is not default connection name.');
        }

        if (!isset($this->connections[$this->defaultConnectionName])) {
            throw new \RuntimeException(sprintf('The default connection "%s" does not exists.', $this->defaultConnectionName));
        }

        return $this->connections[$this->defaultConnectionName];
    }
763888
public function connected()
	{
		// Flag to prevent recursion into this function.
		static $checkingConnected = false;

		if ($checkingConnected)
		{
			// Reset this flag and throw an exception.
			$checkingConnected = true;
			die('Recursion trying to check if connected.');
		}

		// Backup the query state.
		$sql      = $this->sql;
		$limit    = $this->limit;
		$offset   = $this->offset;
		$prepared = $this->prepared;

		try
		{
			// Set the checking connection flag.
			$checkingConnected = true;

			// Run a simple query to check the connection.
			$this->setQuery($this->getConnectedQuery());
			$status = (bool) $this->loadResult();
		}
		catch (\Exception $e)
		{
			// If we catch an exception here, we must not be connected.
			$status = false;
		}

		// Restore the query state.
		$this->sql         = $sql;
		$this->limit       = $limit;
		$this->offset      = $offset;
		$this->prepared    = $prepared;
		$checkingConnected = false;

		return $status;
	}
968636
public function getConnection()
    {
        if (is_null($this->_connection)) {
            $this->setConnection(
                Agl::app()->getConfig('main/db/host'),
                Agl::app()->getConfig('main/db/name'),
                Agl::app()->getConfig('main/db/user'),
                Agl::app()->getConfig('main/db/password')
            );
        }

        return $this->_connection;
    }
195849
public function getAccounts()
    {
        $connected = [];
        /** @var Social[] $accounts */
        $accounts = $this->hasMany(Social::className(), ['user_id' => 'id'])->all();
        /**
         * @var Social $account
         */
        foreach ($accounts as $account) {
            $connected[$account->provider] = $account;
        }

        return $connected;
    }
707351
public function getAvailableConnections()
    {
        // Fetch stored credentials
        $storage = $this->localStorage->get('connections');
        $storage = $this->unifyMultiserversDeclarations($storage);

        // Merge with defaults from config file
        $configuration = $this->config->get('connections');
        $configuration = $this->unifyMultiserversDeclarations($configuration);

        // Merge configurations
        $connections = array_replace_recursive($configuration, $storage);

        return $connections;
    }
857299
static function getConnections() {
		foreach (self::$parameters as $name => $params) {
			self::connect($name);
		}
		return self::$connections;
	}
142104
public function getCurrentFilter()
    {
        $alias = $this->filter_names[$this->position];
        $define = $this->filters[$alias];
        $filter = $this->getFilterByName($define['name'], $define['attributes']);
        return $filter;
    }
440079
public function chosen() : ?Connection
    {
        foreach ($this->loaders as $loader) {
            $confObj = $loader->chosen();

            if ($confObj !== null) {
                return $confObj;
            }
        }

        return null;
    }