Return a new meta table query.

@return \Illuminate\Database\Eloquent\Builder
422772
private function newMetaQuery()
	{
		$meta_model = $this->metaModel();
		$meta_instance = new $meta_model;
		
		$query = $meta_instance->newQuery();
		
		if (method_exists($this, 'metaContext')) {
			if (method_exists($meta_model, 'applyQueryContext')) {
				call_user_func_array(
					array($meta_model, 'applyQueryContext'),
					array($query, $this->metaContext())
				);
			}
		}
		
		return $query;
	}
719637
public function getQueryBuilder()
    {
        if (null === $this->queryBuilder) {
            $builder = QueryBuilderFactory::getQueryBuilder($this->getConnection());
            $this->setTableAlias($builder, $this->getModel()->tableName());
            $builder->setAlias($this->getTableAlias());
            $model = $this->getModel();
            $meta = $model->getMeta();
            $builder->table($model->tableName());

            $fetchColumnCallback = new FetchColumnCallback($model, $meta);
            $callback = new LookupCallback($model);
            $joinCallback = new JoinCallback($model);
            $builder
                ->getLookupBuilder()
                ->setFetchColumnCallback($fetchColumnCallback)
                ->setCallback($callback)
                ->setJoinCallback($joinCallback);
            $this->queryBuilder = $builder;
        }

        return $this->queryBuilder;
    }
924422
public function newQuery()
	{
		$select = ($this->getTableAlias() ? $this->getTableAlias() . '.' : '') . '*';

		$this->query = $this->getQuery()->select($select)->from($this->getTableName(), $this->getTableAlias());
		return $this;
	}
641334
public function queryBuilder()
    {
        if (!$this->queryBuilder) {
            $this->queryBuilder = $this->grid->model()->getQueryBuilder();
        }

        return $this->queryBuilder;
    }
144957
public function getQuery($new = false)
    {
        if (!$this->query || $new) {
            $this->query = $this->db->getQuery(true);
        }

        return $this->query;
    }
626087
protected function newQuery()
    {
        $query = $this->model->newQuery();

        foreach ($this->withRelationships as $relationship) {
            $query->with($relationship);
        }

        return $query;
    }
537033
public static function queryMetas()
	{
		$model = new static;
		
		$conn = $model->getConnection();
		$query = new QueryBuilder(
			$conn,
			$conn->getQueryGrammar(),
			$conn->getPostProcessor()
		);
		
		$query->setModel($model);
		
		return $query;
	}
306293
public function createQuery() {
    $query = $this->db()->createQueryBuilder();
    $query->select('t.*')
      ->from($this->table, 't');

    return $query;
  }
646516
protected function newQuery()
    {
        $query = app("es")->setModel($this);

        $query->connection($this->getConnection());

        if ($index = $this->getIndex()) {
            $query->index($index);
        }

        if ($type = $this->getType()) {
            $query->type($type);
        }

        return $query;
    }
649664
public function newQueryWithoutScopes()
    {
        $builder = $this->newBuilder(
            $this->newBaseQueryBuilder()
        );

        // Once we have the query builders, we will set the model instances so the
        // builder can easily access any information it may need from the model
        // while it is constructing and executing various queries against it.
        return $builder->setModel($this)->with($this->with);
    }
808140
protected function newBaseQueryBuilder()
    {
        $conn = $this->getConnection();

        $grammar = $conn->getQueryGrammar();

        $builder = new Builder($conn, $grammar, $conn->getPostProcessor());

        if (isset($this->rememberFor)) {
            $builder->remember($this->rememberFor);
        }

        if (isset($this->rememberCacheTag)) {
            $builder->cacheTags($this->rememberCacheTag);
        }

        if (isset($this->rememberCachePrefix)) {
            $builder->prefix($this->rememberCachePrefix);
        }

        if (isset($this->rememberCacheDriver)) {
            $builder->cacheDriver($this->rememberCacheDriver);
        }

        return $builder;
    }
580022
public function getQuery($new = false)
    {
        if ($this->query !== null && !$new) {
            return $this->query;
        }

        return new \OtherCode\Database\Query\Query();
    }
1231224
public function createQuery()
    {
        $query = new Query($this->objectType);
        if ($this->defaultOrderings) {
            $query->setOrderings($this->defaultOrderings);
        }
        return $query;
    }
1033911
function getMetadataCache() {
		if (!isset($this->metadatCache)) {
			$this->metadataCache = static::$defaultMetadataCache ?: new Table\StaticCache;
		}
		return $this->metadataCache;
	}
12110
public static function query()
    {
        if (static::$builder instanceof Builder) {
            if (static::$builder->getModel() == static::class) {
                return static::$builder;
            }
        }

        // Reflection action
        $reflection = new \ReflectionClass(static::class);

        $properties = $reflection->getDefaultProperties();

        if ($properties['table'] == null) {
            $parts = explode('\\', static::class);

            $table = end($parts);

            $table = Str::camel(strtolower($table)).'s';
        } else {
            $table = $properties['table'];
        }

        if (!is_null($properties['connexion'])) {
            DB::connection($properties['connexion']);
        }

        if (!is_null($properties['prefix'])) {
            $prefix = $properties['prefix'];
        } else {
            $prefix = DB::getConnectionAdapter()->getTablePrefix();
        }

        $table = $prefix.$table;

        static::$builder = new Builder($table, DB::getPdo());

        static::$builder->setPrefix($prefix);

        static::$builder->setModel(static::class);

        return static::$builder;
    }
1301758
protected function newBaseQueryBuilder()
    {
        $conn    = $this->getConnection();
        $grammar = $conn->getQueryGrammar();

        if ($grammar instanceof OracleGrammar) {
            return new QueryBuilder($conn, $grammar, $conn->getPostProcessor());
        }

        return new IlluminateQueryBuilder($conn, $grammar, $conn->getPostProcessor());
    }
849197
protected function newBaseQueryBuilder()
    {
        $connection = $this->getConnection();

        return new QueryBuilder($connection, $connection->getQueryGrammar(), $connection->getPostProcessor());
    }