Find a collection of models by the given query conditions.

@param  array|Arrayable $where
@param  array $columns
@param  bool  $or
@return Collection|null
972373
public function findWhere($where, $columns = ['*'], $or = false)
    {
        $model = $this->query();

        foreach ($where as $field => $value) {

            if ($value instanceof Closure) {

                $model = ( ! $or)
                    ? $model->where($value)
                    : $model->orWhere($value);

            } elseif (is_array($value)) {

                if (count($value) === 3) {

                    list($field, $operator, $search) = $value;

                    $model = ( ! $or)
                        ? $model->where($field, $operator, $search)
                        : $model->orWhere($field, $operator, $search);

                } elseif (count($value) === 2) {

                    list($field, $search) = $value;

                    $model = ( ! $or)
                        ? $model->where($field, $search)
                        : $model->orWhere($field, $search);
                }

            } else {
                $model = ( ! $or)
                    ? $model->where($field, $value)
                    : $model->orWhere($field, $value);
            }
        }

        return $model->get($columns);
    }
456335
public function or_where()
	{
		$condition = func_get_args();
		is_array(reset($condition)) and $condition = reset($condition);

		return $this->_where($condition, 'or_where');
	}
1311740
public function where($column, $operator = '=', $value = null, $boolean = 'and', array $columns = ['*'])
    {
        return $this->mediator->transform($this->mediator(func_get_args()));
    }
729452
public function findWhere($where, $columns = ['*'], $with = [])
    {
        $where    = $this->castRequest($where);
        $cacheKey = $this->generateKey([$where, $columns, $with]);

        return $this->cacheResults(get_called_class(), __FUNCTION__, $cacheKey, function () use ($where, $columns, $with) {
            $model = $this->model instanceof Model ? $this->model->query() : $this->model;

            foreach ($where as $attribute => $value) {
                if (is_array($value)) {
                    list($attribute, $condition, $value) = $value;

                    $model->where($attribute, $condition, $value);
                } else {
                    $model->where($attribute, '=', $value);
                }
            }

            return $model->with($with)
                ->get($columns);
        });
    }
267906
protected function createIndexModelBuilder(iterable $columns = null): ModelQueryBuilder
    {
        $builder = $this->createBuilder($this->getModelClass());

        $this
            ->applyColumnMapper($builder);

        $builder
            ->selectModelColumns($columns)
            ->fromModelTable();

        $this
            ->applyAliasFilters($builder)
            ->applySorts($builder)
            ->applyRelationshipFiltersAndSorts($builder)
            ->applyPaging($builder);

        $result = $this->builderOnIndex($builder);

        $this->clearBuilderParameters();

        return $result;
    }
401639
public function orWhereMultiple(array $columns)
    {
        $instance = $this->whereStrategyInstance();

        $instance->whereStrategy()->orWhereMultiple($columns);

        return $instance;
    }
615495
public function findWhere(array $wheres, array $columns = ['*'])
    {
        return $this->mediator->transform($this->mediator(func_get_args()))->first();
    }
1337550
public function orWhere($column, $operator, $value = null)
    {
        $this->orWheres[] = new Where($column, $operator, $value, 'OR');

        return $this;
    }
614603
public function findOrFail($id, $columns = ['*'], $with = [])
    {
        $cacheKey = $this->generateKey([$id, $columns, $with]);

        return $this->cacheResults(get_called_class(), __FUNCTION__, $cacheKey, function () use ($id, $columns, $with) {
            return $this->model->with($with)
                ->findOrFail($id, $columns);
        });
    }
1147594
function orwhere($where)
    {
        $args = func_get_args();
        if (count($args) == 1)
        {
            $where = $args[0];
        }
        else
        {
            list($field, $expr, $value) = $args;
            $where = '`'.str_replace('`', '', $field).'`' . $this->db->quote($expr) . " '".$this->db->quote($value)."'";
        }

        if ($this->where == "")
        {
            $this->where = "where " . $where;
        }
        else
        {
            $this->where = $this->where . " or " . $where;
        }
    }
424656
public function findOrFail($id, $columns = ['*'])
    {
        $this->newQuery();

        if ($result = $this->query->find($id, $columns)) {
            return $result;
        }

        throw (new ModelNotFoundException)->setModel($this->model);
    }
1285507
public function findWhere(array $where, $columns = ['*'])
    {
        if (!$this->allowedCache('findWhere') || $this->isSkippedCache()) {
            return parent::findWhere($where, $columns);
        }

        $key = $this->getCacheKey('findWhere', func_get_args());
        $minutes = $this->getCacheMinutes();
        $value = $this->getCacheRepository()->remember($key, $minutes, function () use ($where, $columns) {
            return parent::findWhere($where, $columns);
        });

        $this->resetModel();
        $this->resetScope();
        return $value;
    }
569849
public static function find( $where = 'all', $options = array() )
	{

		$dbr = wfGetDB( DB_SLAVE );

		if ( !is_array( $where ) && $where == 'all' ) {

			/* Fetch all entities */
			$collection = $dbr->select( static::$table,
				'id',
				array(),
				__METHOD__,
				$options
			);

		} else {

			/* Fetch conditional entities */
			$collection = $dbr->select( static::$table,
				'id',
				$where,
				__METHOD__,
				$options
			);

		}

		/* Check result */
		if ( !$collection ) return array();

		/* Generate array of entities for return */
		$entities = array();
		foreach ( $collection as $row ) {

			/* Create entity */
			$modelClass = get_called_class();
			$entity = new $modelClass($row->id);

			$entities[] = $entity;

		}

		if ( !count( $entities ) ) return array();

		return $entities;

	}
107668
public function or_where($wheres = array())
	{
		if (count($wheres) > 0)
		{
			if ( ! isset($this->wheres['$or']) or ! is_array($this->wheres['$or']))
			{
				$this->wheres['$or'] = array();
			}

			foreach ($wheres as $wh => $val)
			{
				$this->wheres['$or'][] = array($wh => $val);
			}
		}
		return $this;
	}
951063
public function findMany($id, $columns = ['*'])
    {
        if (empty($id)) {
            return new EntityCollection();
        }

        $this->query->whereIn($this->entityMap->getKeyName(), $id);

        return $this->get($columns);
    }
1287554
public function find($id, array $columns = ['*'])
    {
        if (is_array($id)) {
            return $this->findMany($id, $columns);
        }

        return $this->getBy($this->getModel()->getQualifiedKeyName(), $id, $columns);
    }
97896
public function findWhere(array $where, $columns = ['*'])
    {
        $this->applyCriteria();
        $this->applyScope();

        $this->applyConditions($where);

        $model = $this->model->get($columns);
        $this->resetModel();

        return $this->parserResult($model);
    }