public function orderBy($key, $direction = 'ASC')
    {
        if (Helpers\Validate::table($this->name)->field($key))
        {
            $directions                        = array(
                'ASC'  => SORT_ASC,
                'DESC' => SORT_DESC
            );
            $this->pending[__FUNCTION__][$key] = isset($directions[$direction]) ? $directions[$direction] : 'ASC';
        }

        return $this;
    }
public function orderBy($key, $direction = 'ASC')
    {
        if (Helpers\Validate::table($this->name)->field($key))
        {
            $directions                        = array(
                'ASC'  => SORT_ASC,
                'DESC' => SORT_DESC
            );
            $this->pending[__FUNCTION__][$key] = isset($directions[$direction]) ? $directions[$direction] : 'ASC';
        }

        return $this;
    }
public function orderBy ( $ key , $ direction = 'ASC' ) { if ( Helpers \ Validate :: table ( $ this -> name ) -> field ( $ key ) ) { $ directions = array ( 'ASC' => SORT_ASC , 'DESC' => SORT_DESC ) ; $ this -> pending [ __FUNCTION__ ] [ $ key ] = isset ( $ directions [ $ direction ] ) ? $ directions [ $ direction ] : 'ASC' ; } return $ this ; }
Sorting data by field
@param string $key Field name
@param string $direction ASC|DESC
@return self
Sorting data by field