Get models by a simple equality query.

@param       $field
@param null  $value
@param array $columns
@return array|EloquentCollection
199741
public function getByField($field, $value = null, $columns = ['*'])
    {
        return $this->simpleWrap(Action::READ, [$this, '_getByField']);
    }
973364
public function get($columns = array('*'))
	{
		if (!$this->applyMetaFilters()) {
			if (!empty($this->aggregate)) {
				return 0;
			}
			return $this->model->newCollection();
		}
		
		if (!empty($this->aggregate)) {
			return parent::get($columns);
		}
		else {
			$results = parent::get(array('m.xref_id'));
		}
		
		if (empty($results)) {
			return $this->model->newCollection();
		}
		
		$xref_ids = array();
		foreach ($results as $result) {
			if (!isset($result->xref_id)) continue;
			$xref_ids[] = $result->xref_id;
		}
		
		if (empty($xref_ids)) {
			return $this->model->newCollection();
		}
		
		$key = $this->model->getKeyName();
		
		$models = $this->model->newQuery()->whereIn($key, $xref_ids)->get();
		
		$models->sortBy(function ($model) use ($xref_ids, $key) {
			foreach ($xref_ids as $idx => $i) {
				if ($model->{$key} == $i) {
					return $idx;
				}
			}
			return 0;
		});
		
		if (!empty($this->relations)) {
			$models->load($this->relations);
		}
		
		return $models;
	}
951756
public function getBy($attribute, $value, $columns = array('*'))
    {
        return $this->model->where($attribute, '=', $value)->get($columns);
    }
521578
def get(self, columns=None):
        
        models = self.get_models(columns)

        # If we actually found models we will also eager load any relationships that
        # have been specified as needing to be eager loaded, which will solve the
        # n+1 query issue for the developers to avoid running a lot of queries.
        if len(models) > 0:
            models = self.eager_load_relations(models)

        collection = self._model.new_collection(models)

        return collection
69170
public function where($column, $operator = '=', $value = null, $boolean = 'and', array $columns = ['*'])
    {
        return $this->repository->makeQuery()->where($column, $operator, $value, $boolean, $columns)->get($columns);
    }
763574
public function findMany($id, $columns = array('*'))
	{
		$this->query->whereIn($this->model->getKeyName(), $id);

		return $this->get($columns);
    }
1088165
private function getTypes($field, $value, ClassMetadata $class)
    {
        $property = $class->getProperty($field);
        $types    = [];

        switch (true) {
            case $property instanceof FieldMetadata:
                $types = array_merge($types, [$property->getType()]);
                break;

            case $property instanceof AssociationMetadata:
                $class = $this->em->getClassMetadata($property->getTargetEntity());

                if (! $property->isOwningSide()) {
                    $property = $class->getProperty($property->getMappedBy());
                    $class    = $this->em->getClassMetadata($property->getTargetEntity());
                }

                $joinColumns = $property instanceof ManyToManyAssociationMetadata
                    ? $property->getJoinTable()->getInverseJoinColumns()
                    : $property->getJoinColumns();

                foreach ($joinColumns as $joinColumn) {
                    /** @var JoinColumnMetadata $joinColumn */
                    $referencedColumnName = $joinColumn->getReferencedColumnName();

                    if (! $joinColumn->getType()) {
                        $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $class, $this->em));
                    }

                    $types[] = $joinColumn->getType();
                }

                break;

            default:
                $types[] = null;
                break;
        }

        if (is_array($value)) {
            return array_map(static function ($type) {
                return $type->getBindingType() + Connection::ARRAY_PARAM_OFFSET;
            }, $types);
        }

        return $types;
    }
1051783
public function findBy($attribute, $value, $columns = ['*'])
    {
        return $this->postProcess( parent::findBy($attribute, $value, $columns) );
    }
7270
protected function modelWhere($column, $value = null)
    {
        $this->model = $this->model->where($column, $value);
        return $this;
    }
324752
public function get(array $columns = [])
    {
        $data = parent::get($columns);

        $model = $this->model;

        if (!is_array($data)) {
            return new $model((array) $data);
        }
        
        foreach ($data as $key => $value) {
            $data[$key] = new $model((array) $value);
        }

        return new Collection($data);
    }
428656
public function get($columns = ['*'])
    {
        $builder = $this->applyScopes();

        // If we actually found models we will also eager load any relationships that
        // have been specified as needing to be eager loaded, which will solve the
        // n+1 query issue for the developers to avoid running a lot of queries.
        if (count($models = $builder->getModels($columns)) > 0) {
            $models = $builder->eagerLoadRelations($models);
        }

        return $models;
    }
962409
public function findBy($columns, $value = null)
    {
        $this->loadAll();

        if (!is_array($columns)) {
            $columns = array($columns => $value);
        }

        $result = array();
        foreach ($this->allUnits as $u) {
            $status = true;
            foreach ($columns as $column => $value) {
                $unitValue = call_user_func(array($u, 'get'.ucfirst($column)));
                $status &= is_array($value) ? in_array($unitValue, $value) : $unitValue == $value;
            }
            if ($status) {
                $result[] = $u;
            }
        }

        return $result;
    }
399573
public function get($columns = ['*']): Collection
    {
        // First we'll add the proper select columns onto the query so it is run with
        // the proper columns. Then, we will get the results and hydrate out pivot
        // entities with the result of those columns as a separate model relation.
        $select = $this->getSelectColumns($columns);

        $entities = $this->query->addSelect($select)->getEntities();

        // If we actually found entities we will also eager load any relationships that
        // have been specified as needing to be eager loaded. This will solve the
        // n + 1 query problem for the developer and also increase performance.
        if (count($entities) > 0) {
            $entities = $this->query->eagerLoadRelations($entities);
        }

        return $this->relatedMap->newCollection($entities);
    }
11339
public function findByOrFail($attribute, $value, $columns = [])
    {
        return $this->whereEquals($attribute, $value)->firstOrFail($columns);
    }
456341
public function eq($column, $value = null)
    {
        return $this->where($column, $value, Cmp::EQ);
    }
507399
public function findWhereNotIn($field, array $values, $columns = ['*'])
    {
        return parent::findWhereNotIn(
            $this->getColumnName($field),
            $values,
            $this->getColumnsNames($columns)
        );
    }
622684
public function get($columns = ['*'])
    {
        $original = $this->columns;

        if (is_null($original)) {
            $this->columns = $columns;
        }

        // encrypted columns replace their default (original) columns
        if ($this->encryptionModel instanceof Model
            && method_exists($this->encryptionModel, 'getEncryptKey')
        ) {
            $model = $this->encryptionModel;
            $modelEncryptionColumns = $model::getEncryptedFields();
            if (!empty($modelEncryptionColumns)) {
                if ($columns == ['*']) {
                    $this->columns = [];

                    /*
                     * Select all visible columns (avoid select *)
                     */
                    $visibles = array_diff(array_merge($model->getFillable(), $model->getGuarded()), $model->getHidden());
                    $unencryptedVisibles = array_unique(array_diff($visibles, array_column($this->encryptionColumns, 'column')));
                    sort($unencryptedVisibles);

                    $primaryKey = [
                        $model->getKeyName()
                    ];

                    $attributes = array_merge($primaryKey, $unencryptedVisibles);

                    if ($model->usesTimestamps()) {
                        $attributes[] = $model->getCreatedAtColumn();
                        $attributes[] = $model->getUpdatedAtColumn();
                    }

                    // add all visible unencrypted columns
                    foreach ($attributes as $attribute) {
                        $this->columns[] = $attribute;
                    }

                    // add all encrypted columns
                    $this->columns = array_merge($this->columns, array_column($this->encryptionColumns, 'select'));
                } else {
                    $this->columns = [];

                    // add all visible unencrypted columns
                    $encryptionColumnNames = array_column($this->encryptionColumns, 'column');
                    foreach ($columns as $column) {
                        if (!in_array($column, $encryptionColumnNames)) {
                            $this->columns[] = $column;
                        }
                    }
                    // add the encrypted columns (and decrypted, if 'withDecryptionKey' was given)
                    foreach ($this->encryptionColumns as $encryptionColumn){
                        if (in_array($encryptionColumn['column'], $columns)) {
                            $this->columns[] = $encryptionColumn['select'];
                        }
                    }
                }
            }
        }

        $results = $this->processor->processSelect($this, $this->runSelect());

        $this->columns = $original;

        return collect($results);
    }