vendor/yajra/laravel-datatables-oracle/src/Engines/QueryBuilderEngine.php
/**
     * Perform sorting of columns.
     *
     * @return void
     */
Perform sorting of columns.
@return void
Perform sorting of columns . @return void
public function ordering()
    {
        if ($this->orderCallback) {
            call_user_func($this->orderCallback, $this->getQueryBuilder());
            return;
        }
        foreach ($this->request->orderableColumns() as $orderable) {
            $column = $this->getColumnName($orderable['column'], true);
            if ($this->isBlacklisted($column) && ! $this->hasCustomOrder($column)) {
                continue;
            }
            if ($this->hasCustomOrder($column)) {
                $method     = $this->columnDef['order'][$column]['method'];
                $parameters = $this->columnDef['order'][$column]['parameters'];
                $this->compileColumnQuery(
                    $this->getQueryBuilder(),
                    $method,
                    $parameters,
                    $column,
                    $orderable['direction']
                );
            } else {
                $valid = 1;
                if (count(explode('.', $column)) > 1) {
                    $eagerLoads     = $this->getEagerLoads();
                    $parts          = explode('.', $column);
                    $relationColumn = array_pop($parts);
                    $relation       = implode('.', $parts);
                    if (in_array($relation, $eagerLoads)) {
                        $lastQuery     = $this->query;
                        $isMorphToMany = false;
                        foreach (explode('.', $relation) as $eachRelation) {
                            $relationship = $lastQuery->getRelation($eachRelation);
                            if (! ($relationship instanceof MorphToMany)) {
                                $isMorphToMany = true;
                            }
                            $lastQuery = $relationship;
                        }
                        if ($isMorphToMany) {
                            $column = $this->joinEagerLoadedColumn($relation, $relationColumn);
                        } else {
                            $valid = 0;
                        }
                    }
                }
                if ($valid == 1) {
                    if ($this->nullsLast) {
                        $this->getQueryBuilder()->orderByRaw($this->getNullsLastSql($column, $orderable['direction']));
                    } else {
                        $this->getQueryBuilder()->orderBy($column, $orderable['direction']);
                    }
                }
            }
        }
    }
public function ordering ( ) { if ( $ this -> orderCallback ) { call_user_func ( $ this -> orderCallback , $ this -> getQueryBuilder ( ) ) ; return ; } foreach ( $ this -> request -> orderableColumns ( ) as $ orderable ) { $ column = $ this -> getColumnName ( $ orderable [ 'column' ] , true ) ; if ( $ this -> isBlacklisted ( $ column ) && ! $ this -> hasCustomOrder ( $ column ) ) { continue ; } if ( $ this -> hasCustomOrder ( $ column ) ) { $ method = $ this -> columnDef [ 'order' ] [ $ column ] [ 'method' ] ; $ parameters = $ this -> columnDef [ 'order' ] [ $ column ] [ 'parameters' ] ; $ this -> compileColumnQuery ( $ this -> getQueryBuilder ( ) , $ method , $ parameters , $ column , $ orderable [ 'direction' ] ) ; } else { $ valid = 1 ; if ( count ( explode ( '.' , $ column ) ) > 1 ) { $ eagerLoads = $ this -> getEagerLoads ( ) ; $ parts = explode ( '.' , $ column ) ; $ relationColumn = array_pop ( $ parts ) ; $ relation = implode ( '.' , $ parts ) ; if ( in_array ( $ relation , $ eagerLoads ) ) { $ lastQuery = $ this -> query ; $ isMorphToMany = false ; foreach ( explode ( '.' , $ relation ) as $ eachRelation ) { $ relationship = $ lastQuery -> getRelation ( $ eachRelation ) ; if ( ! ( $ relationship instanceof MorphToMany ) ) { $ isMorphToMany = true ; } $ lastQuery = $ relationship ; } if ( $ isMorphToMany ) { $ column = $ this -> joinEagerLoadedColumn ( $ relation , $ relationColumn ) ; } else { $ valid = 0 ; } } } if ( $ valid == 1 ) { if ( $ this -> nullsLast ) { $ this -> getQueryBuilder ( ) -> orderByRaw ( $ this -> getNullsLastSql ( $ column , $ orderable [ 'direction' ] ) ) ; } else { $ this -> getQueryBuilder ( ) -> orderBy ( $ column , $ orderable [ 'direction' ] ) ; } } } } }
Perform sorting of columns.
Perform sorting of columns .
// Loop for nested relations // This code is check morph many or not. // If one of nested relation is MorphToMany // we will call joinEagerLoadedColumn.