public function orderBy($column, $direction)
    {
        // Ensure the sort is valid
        if (in_array($column, $this->orderable) === false
            && array_key_exists($column, $this->orderable) === false
        ) {
            return $this;
        }

        // One time skip
        $this->skipOrderingOnce = true;

        return $this->addScopeQuery(function ($query) use ($column, $direction) {

            // Get valid sort order
            $direction = in_array(strtolower($direction), ['desc', 'asc']) ? $direction : 'asc';

            // Check for table column mask
            $column = Arr::get($this->orderable, $column, $column);

            return $query->orderBy($this->appendTableName($column), $direction);
        });
    }
public function orderBy($column, $direction)
    {
        // Ensure the sort is valid
        if (in_array($column, $this->orderable) === false
            && array_key_exists($column, $this->orderable) === false
        ) {
            return $this;
        }

        // One time skip
        $this->skipOrderingOnce = true;

        return $this->addScopeQuery(function ($query) use ($column, $direction) {

            // Get valid sort order
            $direction = in_array(strtolower($direction), ['desc', 'asc']) ? $direction : 'asc';

            // Check for table column mask
            $column = Arr::get($this->orderable, $column, $column);

            return $query->orderBy($this->appendTableName($column), $direction);
        });
    }
public function orderBy ( $ column , $ direction ) { // Ensure the sort is valid if ( in_array ( $ column , $ this -> orderable ) === false && array_key_exists ( $ column , $ this -> orderable ) === false ) { return $ this ; } // One time skip $ this -> skipOrderingOnce = true ; return $ this -> addScopeQuery ( function ( $ query ) use ( $ column , $ direction ) { // Get valid sort order $ direction = in_array ( strtolower ( $ direction ) , [ 'desc' , 'asc' ] ) ? $ direction : 'asc' ; // Check for table column mask $ column = Arr :: get ( $ this -> orderable , $ column , $ column ) ; return $ query -> orderBy ( $ this -> appendTableName ( $ column ) , $ direction ) ; } ) ; }
Order results by.

@param string $column
@param string $direction

@return self
Order results by .