Get the query object to be processed by dataTables.

@return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder|\Illuminate\Support\Collection
194223
public function query()
    {
        $query = app($this->model)->query()->with(['ticketable']);

        return $this->applyScopes($query);
    }
494879
public function getQuery()
	{
		if (!$this->query) {
			$this->query = new Query($this->driver, $this->preprocessor);
		}

		return $this->query;
	}
244935
public function getQuery()
    {
        $properties = array(
            'data' => $this,
        );
        $wrapper = new \stdClass();
        $collection = new \StdClass();
        foreach ($properties as $name => $value) {
            if (is_array( $value )) {
                foreach ($value as &$val) {
                    if (is_object( $val )) {
                        $val = $val->output();
                    }
                }
            }
            if (is_object( $value ) && !$value instanceof \StdClass) {
                $value = $value->output();
            }
            $collection->$name = $value;
        }
        $wrapper->template = $collection;
        return json_encode($wrapper);
    }
549338
public function get()
    {
        $query = $this->getCriteria();

        $args = func_get_args();
        if(empty($args)){
            $args = null;
        }

        $isCollection = $this->isCollection($args);

        $response = '';

        try {
            $response = $this->client->request($this, 'get', $args, array(), $query);
        } catch(Exception $ex) {
            $this->dispatchException($ex);
        }

        return $this->transformResponse($response, $isCollection);
    }
247753
public function queryObject()
    {
        $bindingType = $this->options['bindingType'];

        $queryObj = [];
        $queryObj['queryString'] = $this->query;
        $queryObj['allowLiterals'] = (bool) $this->options['allowLiterals'];

        $bindings = $this->mapBindings($bindingType, $this->options['bindings']);
        if (!empty($bindings)) {
            $queryObj[$this->options['bindingType']] = $bindings;
        }

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

        return $this->queryBuilder;
    }
927549
private function getQueries()
    {
        $queries = [
            'all'      => $this->queryFactory->create(
                QueryInterface::TYPE_BOOL,
                []
            ),
            'searches' => $this->queryFactory->create(
                QueryInterface::TYPE_TERM,
                [
                    'field' => 'page.type.identifier',
                    'value' => 'catalogsearch_result_index',
                ]
            ),
        ];

        return $queries;
    }
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;
    }
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' ";
    }
378494
protected function _getQuery()
    {
        // active AJAX component
        $sGroupTable = $this->_getViewName('oxgroups');
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $sDiscountId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxid');
        $sSynchDiscountId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');

        // category selected or not ?
        if (!$sDiscountId) {
            $sQAdd = " from $sGroupTable where 1 ";
        } else {
            $sQAdd = " from oxobject2group left join $sGroupTable on oxobject2group.oxgroupsid=$sGroupTable.oxid ";
            $sQAdd .= " where oxobject2group.oxobjectid = " . $oDb->quote($sDiscountId);
        }

        if ($sSynchDiscountId && $sSynchDiscountId != $sDiscountId) {
            $sQAdd .= ' and ' . $sGroupTable . '.oxid not in ( select ' . $sGroupTable . '.oxid from oxobject2group left join ' . $sGroupTable . ' on oxobject2group.oxgroupsid=' . $sGroupTable . '.oxid ';
            $sQAdd .= " where oxobject2group.oxobjectid = " . $oDb->quote($sSynchDiscountId) . " ) ";
        }

        return $sQAdd;
    }
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;
    }
147170
public function getQueries()
    {
        return array_merge(
            $this->createNamespaceQueries,
            $this->createTableQueries,
            $this->createSequenceQueries,
            $this->createFkConstraintQueries
        );
    }
1231224
public function createQuery()
    {
        $query = new Query($this->objectType);
        if ($this->defaultOrderings) {
            $query->setOrderings($this->defaultOrderings);
        }
        return $query;
    }
586220
public function getData()
    {
        /**
         * Eloquent's built in "paginate" method does not work well when the query contains "join", "having", or "groupby"
         * so to make things work more reliably we just create the paginator object by hand after running the query
         * TODO: find a way to not use the Paginator Facade
         */
        if ($this->options['paginate'])
        {
            $currentPage = \Paginator::getCurrentPage();

            $total = (int) $this->getQuery()->count();
            $slice = $this->getQuery()->forPage($currentPage, $this->perPage)->get();

            $models = \Paginator::make($slice->all(), $total, $this->perPage);
        } else {
            $models =  $this->getQuery()->get();
        }

        return $models;
    }
1184998
protected function _getQuery()
    {
        // looking for table/view
        $sCatTable = $this->_getViewName('oxcategories');
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $sDelId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxid');
        $sSynchDelId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');

        // category selected or not ?
        if (!$sDelId) {
            $sQAdd = " from {$sCatTable} ";
        } else {
            $sQAdd = " from oxobject2delivery left join {$sCatTable} " .
                     "on {$sCatTable}.oxid=oxobject2delivery.oxobjectid " .
                     " where oxobject2delivery.oxdeliveryid = " . $oDb->quote($sDelId) .
                     " and oxobject2delivery.oxtype = 'oxcategories' ";
        }

        if ($sSynchDelId && $sSynchDelId != $sDelId) {
            // performance
            $sSubSelect = " select {$sCatTable}.oxid from oxobject2delivery left join {$sCatTable} " .
                          "on {$sCatTable}.oxid=oxobject2delivery.oxobjectid " .
                          " where oxobject2delivery.oxdeliveryid = " . $oDb->quote($sSynchDelId) .
                          " and oxobject2delivery.oxtype = 'oxcategories' ";
            if (stristr($sQAdd, 'where') === false) {
                $sQAdd .= ' where ';
            } else {
                $sQAdd .= ' and ';
            }
            $sQAdd .= " {$sCatTable}.oxid not in ( $sSubSelect ) ";
        }

        return $sQAdd;
    }
847602
protected function _getQuery()
    {
        // looking for table/view
        $sArtTable = $this->_getViewName('oxarticles');
        $sO2CView = $this->_getViewName('oxobject2category');
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();

        // category selected or not ?
        if ($sSynchOxid = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid')) {
            $sQAdd = " from $sArtTable left join $sO2CView on $sArtTable.oxid=$sO2CView.oxobjectid where $sO2CView.oxcatnid = " . $oDb->quote($sSynchOxid);
            if ($aSkipArt = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('neworder_sess')) {
                $sQAdd .= " and $sArtTable.oxid not in ( " . implode(", ", \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aSkipArt)) . " ) ";
            }
        } else {
            // which fields to load ?
            $sQAdd = " from $sArtTable where ";
            if ($aSkipArt = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('neworder_sess')) {
                $sQAdd .= " $sArtTable.oxid in ( " . implode(", ", \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($aSkipArt)) . " ) ";
            } else {
                $sQAdd .= " 1 = 0 ";
            }
        }

        return $sQAdd;
    }
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;
    }