Get the query object to be processed by datatables.

@return \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder
330794
public function query()
    {
        $users = Widget::query()
                       ->select('widgets.*')
                       ->with([
                           'extension' => function ($query) {
                               $query->select('id', 'name');
                           },
                       ])
                       ->withoutGlobalScope('menu_assignment');

        return $this->applyScopes($users);
    }
301876
public function getQueryBuilder()
    {
        /** @var $queryBuilder QueryBuilder */
        $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
            ->getQueryBuilderForTable('tx_gridelements_backend_layout');
        $queryBuilder->getRestrictions()
            ->removeAll()
            ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
            ->add(GeneralUtility::makeInstance(HiddenRestriction::class));
        return $queryBuilder;
    }
201210
public function build()
    {
        $query = $this->delegate->build();
        $this->utilityRegistry->addUtility(AdsUtility::SERVICE_QUERY_BUILDER);
        return $query;
    }
643710
private function getSearchQuery()
    {
        $queries = [];

        foreach ($this->queryProviders as $queryProvider) {
            $queries[] = $queryProvider->getQuery();
        }

        return array_filter($queries);
    }
1262840
public function getQuery()
    {
        $query = null;

        switch ($this->type) {
            case self::SELECT:
                $query = $this->getSelectQuery();
                break;
            case self::INSERT:
                $query = $this->getInsertQuery();
                break;
            case self::UPDATE:
                $query = $this->getUpdateQuery();
                break;
            case self::DELETE:
                $query = $this->getDeleteQuery();
                break;
        }

        return $query;
    }
446785
public function getQuery()
    {
        $sql = $this->prepareSelectString();
        $sql .= $this->prepareJoinString();
        $sql .= $this->prepareWhereString();
        $sql .= $this->prepareGroupByString();
        $sql .= $this->prepareHavingString();
        $sql .= $this->prepareOrderByString();
        $sql .= $this->prepareLimitString();

        return $sql;
    }
202621
public function getQueryBuilder()
    {
        if (!is_object($this->_queryBuilder)) {
            $this->_queryBuilder = Yii::createObject($this->_queryBuilder, [$this]);
        }
        return $this->_queryBuilder;
    }
1324115
public function getQuery()
    {
        $queryParts = array_map(function ($value) {
            return ($value instanceof Operator) ? $value->expression() : $value;
        }, $this->queryParts);

        return implode('', $queryParts);
    }
481026
public function getQueryBuilder()
    {
        if (!isset($this->queryBuilder)) {
            $this->queryBuilder = $this->getGeneratorConfig()->getConfiguredBuilder($this->getTable(), 'query');
        }

        return $this->queryBuilder;
    }
1047105
public function dataTable()
    {
        return (new EloquentDataTable($this->query()))
            ->editColumn('alias', function (Menu $menu) {
                return '<span class="label bg-primary">' . $menu->alias . '</span>';
            })
            ->editColumn('published', function (Menu $menu) {
                return dt_check($menu->published);
            })
            ->editColumn('authenticated', function (Menu $menu) {
                return view('administrator.navigation.menu.datatables.authenticated', $menu->toArray());
            })
            ->editColumn('title', function (Menu $menu) {
                return view('administrator.navigation.menu.datatables.title', compact('menu'))->render();
            })
            ->addColumn('type', function (Menu $menu) {
                return $menu->extension->name;
            })
            ->editColumn('lft', '<i class="fa fa-dot-circle-o"></i>')
            ->addColumn('action', 'administrator.navigation.menu.datatables.action')
            ->rawColumns(['alias', 'published', 'authenticated', 'title', 'lft', 'action']);
    }
318343
public function get()
	{
		// Get the columns
		$columns = $this->select();

		// Start building the query
		$select = $columns;
		if ($this->use_subquery())
		{
			$select = array();
			foreach ($columns as $c)
			{
				$select[] = $c[0];
			}
		}

		$query = call_fuel_func_array('DB::select', $select);

		// Set from view/table
		$query->from(array($this->_table(), $this->alias));

		// Build the query further
		$tmp     = $this->build_query($query, $columns);
		$query   = $tmp['query'];
		$models  = $tmp['models'];

		// Make models hierarchical
		foreach ($models as $name => $values)
		{
			if (strpos($name, '.'))
			{
				unset($models[$name]);
				$rels = explode('.', $name);
				$ref =& $models[array_shift($rels)];
				foreach ($rels as $rel)
				{
					empty($ref['models']) and $ref['models'] = array();
					empty($ref['models'][$rel]) and $ref['models'][$rel] = array();
					$ref =& $ref['models'][$rel];
				}
				$ref = $values;
			}
		}

		$rows = $query->execute($this->connection)->as_array();
		$result = array();
		$model = $this->model;
		$select = $this->select();
		$primary_key = $model::primary_key();
		foreach ($rows as $id => $row)
		{
			$this->hydrate($row, $models, $result, $model, $select, $primary_key);
			unset($rows[$id]);
		}

		// It's all built, now lets execute and start hydration
		return $result;
	}
477971
public function query()
    {
        if (!auth()->guest() && auth()->user()->hasRoles('member')) {
            $this->userId = auth()->user()->id;
        }

        $query = ModuleRow::withoutGlobalScopes()->select(['id', 'name', 'user_id', 'value'])->with('user');

        if (!is_null($this->userId)) {
            $query->where('user_id', $this->userId);
        }
        Event::listen('datatables.order.description', function($query, $direction) {
            $query->orderBy('description', $direction)->orderBy('name', 'desc');
        });
        return $query;
    }
771189
public function isSourceQueryBuilder()
    {
        return is_object($this->getSource()) && get_class($this->getSource()) == \Illuminate\Database\Query\Builder::class;
    }
641334
public function queryBuilder()
    {
        if (!$this->queryBuilder) {
            $this->queryBuilder = $this->grid->model()->getQueryBuilder();
        }

        return $this->queryBuilder;
    }
1258025
protected function getQueryResult()
    {
        if ($this->queryResult) {
            return $this->queryResult;
        }

        return $this->queryResult = $this->getSelector()
            ->getSelectBuilder()
            ->execute();
    }
1238160
protected function _getQuery()
    {
        $sSelTable = $this->_getViewName('oxselectlist');
        $sArtId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxid');

        return " from $sSelTable left join oxobject2selectlist on oxobject2selectlist.oxselnid = $sSelTable.oxid " .
                 "where oxobjectid = '$sArtId' ";
    }
229260
public function getQuery()
    {
        if (is_null($this->query)) {
            $params = $this->getParameters();
            $params = array_map(array($this, 'htmlDecode'), $params);
            $params = array_map(array($this, 'encode'), $params);

            $this->setQuery(http_build_query($params, "", "&"));
        }

        return $this->query;
    }